Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4916752

Wrong discriminator received on a union with multiple case labels on a branch

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.4.1
    • 1.4.2
    • other-libs
    • None
    • 07
    • generic
    • windows_nt
    • Not verified

        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.
        >

              minqi Yumin Qi
              cprasadsunw Ck Prasad (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: