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

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 1.4.2
    • Fix Version/s: 1.4.1
    • Component/s: other-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      07
    • CPU:
      generic
    • OS:
      windows_nt
    • Verification:
      Not verified

      Backports

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

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: