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)
void testmcls(inout U u);
>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);
>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 :
>Discriminator value should be 2.
>Discriminator value was 1.
>ERROR MESSAGES/STACK TRACES THAT OCCUR :
>This bug can be reproduced always.