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

unmarshal error on CORBA alias type in CORBA any

XMLWordPrintable

    • x86
    • windows_2000, windows_xp

        Name: rmT116609 Date: 04/22/2004


        FULL PRODUCT VERSION :
        java version "1.4.2_04"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
        Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)

        FULL OS VERSION :
        Microsoft Windows 2000 [Version 5.00.2195]

        A DESCRIPTION OF THE PROBLEM :
        When an org.omg.CORBA.Any type is assigned a value using an alias type (e.g. from IDL definition: typedef string myString;), the insert operation on the generated helper class (generated by the "idlj" IDL compiler) fails with a null pointer exception.


        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Step 1: create a file bug.idl with the following content:

        // IDL file bug.idl
        module bug {
            typedef string myString;
        };

        Step 2: Translate bug.idl with the command: idlj bug.idl
        This will create the file bug/myStringHelper.java

        Step 3:
        Create the file JavaBug.java in directory bug with the following content:

        // Java file JavaBug.java
        package bug;

        public class JavaBug {
            public static void main(String[] args) {
                try {
                    org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null);
                    org.omg.CORBA.Any any = orb.create_any();
                    myStringHelper.insert(any, "hello");
                    System.out.println("Any: " + myStringHelper.extract(any));
                } catch( Exception e ) {
                    e.printStackTrace();
                }
            }
        }

        Step 4:
        Compile all java files with the command: javac -d . bug\*.java

        Step 5:
        Execute the program with the command: java -cp . bug/JavaBug

        Step 6: Note the null pointer exception in the the output!


        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        The following message should be printed on the console:
        Any: hello
        ACTUAL -
        java.lang.NullPointerException
                at com.sun.corba.se.internal.corba.TCUtility.unmarshalIn(TCUtility.java:290)
                at com.sun.corba.se.internal.corba.AnyImpl.read_value(AnyImpl.java:561)
                at bug.myStringHelper.insert(myStringHelper.java:20)
                at bug.JavaBug.main(JavaBug.java:8)

        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        java.lang.NullPointerException
                at com.sun.corba.se.internal.corba.TCUtility.unmarshalIn(TCUtility.java:290)
                at com.sun.corba.se.internal.corba.AnyImpl.read_value(AnyImpl.java:561)
                at bug.myStringHelper.insert(myStringHelper.java:20)
                at bug.JavaBug.main(JavaBug.java:8)

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        // IDL file bug.idl
        module bug {
            typedef string myString;
        };

        // Java file JavaBug.java
        package bug;

        public class JavaBug {
            public static void main(String[] args) {
                try {
                    org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null);
                    org.omg.CORBA.Any any = orb.create_any();
                    myStringHelper.insert(any, "hello");
                    System.out.println("Any: " + myStringHelper.extract(any));
                } catch( Exception e ) {
                    e.printStackTrace();
                }
            }
        }
        ---------- END SOURCE ----------
        (Incident Review ID: 190857)
        ======================================================================

              duke J. Duke
              rmandalasunw Ranjith Mandala (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: