JDK-5036554 : unmarshal error on CORBA alias type in CORBA any
  • Type: Bug
  • Component: other-libs
  • Sub-Component: corba:idl
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_2000,windows_xp
  • CPU: x86
  • Submitted: 2004-04-23
  • Updated: 2014-10-15
  • Resolved: 2013-09-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
Other JDK 6 JDK 7 JDK 8
1.4.2_09Fixed 6u71Fixed 7u76Fixed 8Fixed
Related Reports
Duplicate :  
Relates :  
Description
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) 
======================================================================

Comments
This was fixed in JDK 1.4.2. Reopening bug to correct bug record and mark as "fixed".
2013-09-24

EVALUATION This was closed but unverified. As an old P5, I am closing it now.
2008-10-29

EVALUATION Not a tiger stopper. ###@###.### 2004-07-28
2004-07-28