United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-5036554 unmarshal error on CORBA alias type in CORBA any
JDK-5036554 : unmarshal error on CORBA alias type in CORBA any

Details
Type:
Bug
Submit Date:
2004-04-23
Status:
Closed
Updated Date:
2014-05-14
Project Name:
JDK
Resolved Date:
2013-09-24
Component:
other-libs
OS:
windows_xp,windows_2000
Sub-Component:
corba:idl
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.4.2
Fixed Versions:
1.4.2_09

Related Reports
Backport:
Backport:
Backport:
Backport:
Duplicate:
Relates:

Sub Tasks

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
EVALUATION

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

This was closed but unverified.  As an old P5, I am closing it now.
                                     
2008-10-29
This was fixed in JDK 1.4.2. Reopening bug to correct bug record and mark as "fixed".
                                     
2013-09-24



Hardware and Software, Engineered to Work Together