|
Quick Lists
|
|
Bug ID:
|
4916752
|
|
Votes
|
0
|
|
Synopsis
|
Wrong discriminator received on a union with multiple case labels on a branch
|
|
Category
|
idl:idl-java
|
|
Reported Against
|
1.4.2
|
|
Release Fixed
|
1.4.1(1.4.1_07),
1.4.2(1.4.2_04) (Bug ID:2074260)
, tiger-b31(Bug ID:2074261)
, tiger-b32(Bug ID:2074262)
|
|
State
|
11-Closed,
Unverified,
bug
|
|
Priority:
|
2-High
|
|
Related Bugs
|
|
|
Submit Date
|
03-SEP-2003
|
|
Description
|
Customer problem description:
>synopsis: wrong discriminator received on a union with multiple case
>labels on a branch
>description: FULL PRODUCT VERSION :
>java version "1.4.2_01"
>Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_01-b06)
>Java HotSpot(TM) Client VM (build 1.4.2_01-b06, mixed mode)
>
>
>FULL OS VERSION :
>Windows NT Version 4.0
>
>
>A DESCRIPTION OF THE PROBLEM :
>Consider this IDL union with a branch that has multiple case labels.
// Multiple case labels per member.
// ================================================================
union U switch(long)
{
case 1:
case 2:
long longer;
default:
short shot;
};
// Interfaces
// ================================================================
interface Simple
{
void testmcls(inout U u);
};
interface SimpleFactory
{
Simple find_simple();
};
>
>In either client or server, select the "longer" branch, setting the
>discriminator to 2. Now pass the union to the other side, and examine
>it: the discriminator value is 1.
>
>Here's a swatch of the UHelper.read() code generated by idlj:
>
> public static U read (org.omg.CORBA.portable.InputStream istream)
> {
> U value = new U ();
> int _dis0 = (int)0;
> _dis0 = istream.read_long ();
> switch (_dis0)
> {
> case 1:
> case 2:
> int _longer = (int)0;
> _longer = istream.read_long ();
> value.longer (_longer);
> break;
>
>Shouldn't it be doing this instead?
>
> value.longer (_dis0, _longer);
UHelper.write() is sending the union's discriminator
correctly, but UHelper.read() isn't selecting the union's "longer"
branch with the discriminator _dis0 that it had just read.
The same problem also exists in the default branch in UHelper.read().
>
>STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
>Use idlj to generate code.
>Build a CORBA application that passes the union from client to server.
>Select the "longer" union member, setting the discriminant to 2.
>Pass the union to the other side.
>Examine the discriminator value, which should be 2, but it is 1.
>
>
>EXPECTED VERSUS ACTUAL BEHAVIOR :
>EXPECTED -
>Discriminator value should be 2.
>
>ACTUAL -
>Discriminator value was 1.
>
>
>ERROR MESSAGES/STACK TRACES THAT OCCUR :
>none.
>
>
>REPRODUCIBILITY :
>This bug can be reproduced always.
>
|
|
Work Around
|
Hand-edit the generated UHelper.read() method.
|
|
Evaluation
|
In src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java:
function readBranch did not output the discriminator string. We need to change it to have the output have this part. See Suggested Fix.
xxxxx@xxxxx 2003-09-29
|
|
Comments
|
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |