Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 5036554
Votes 4
Synopsis unmarshal error on CORBA alias type in CORBA any
Category idl:other
Reported Against 1.4.2
Release Fixed , 5.0u11(b01) (Bug ID:2142288)
State 11-Closed, Will Not Fix, bug
Priority: 4-Low
Related Bugs 6474137
Submit Date 23-APR-2004
Description


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 :
 customer  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) 
======================================================================
Work Around
N/A
Evaluation
Not a tiger stopper.
  xxxxx@xxxxx   2004-07-28
This was closed but unverified.  As an old P5, I am closing it now.
Posted Date : 2008-10-29 17:04:16.0
Comments
  
  Include a link with my name & email   

Submitted On 01-DEC-2004
yan.zhuang
This is the first, hope it will be the last, bug that  stops me from migrating to sun


Submitted On 01-DEC-2004
yan.zhuang
This is the first, hope it will be the last, bug that stops
me from migrating to sun's implementation.

There was a similar bug (ID: 4712731) reported in July 
of 2002. It was closed without any explanation.

The bug actually stops uses of any kind of alias type.
It should be fixed ASAP. 

I would like to be informed as soon as it fixed.


Submitted On 18-MAR-2005
dsundstrom
Here is a very simple test to reproduce:

public class AnyTest extends junit.framework.TestCase {
    public void testAny() throws Exception {
        org.omg.CORBA.Any any = org.omg.CORBA.ORB.init().create_any();
        org.omg.IOP.ServiceIdHelper.insert(any, 42);
    }
}


The fix should be as simple as replacing com.sun.corba.se.internal.corbaAnyImpl:561

	TCUtility.unmarshalIn(in, typeCode, longholder, objholder);

with

	TCUtility.unmarshalIn(in, realType(), longholder, objholder);



Submitted On 21-SEP-2006
Cranberry_Lambic
This bug might be fixed in the 1.4.2_09 release but I am seeing it in the latest 1.5.0_08 update.


Submitted On 29-DEC-2006
weberjn
Bug is still in JDK 1.6.0
It also triggers for structs (seems be triggered by all streamed types):

struct ServiceData 
{
	long id;
	sequence<octet> data;
};
ServiceData data = ...
Any any = ORB.init().create_any();
ServiceDataHelper.insert(any, data);		
ServiceData data1 = ServiceDataHelper.extract(any);


Submitted On 25-MAR-2009
swehner
We've tested this bug and it is still not working in 1.6.0_u13.
This is really annoying, especially as this bug is really old and it seems to have been fixed in the 1.5.0u11 release... or at least that's what bug 2142288 says.



PLEASE NOTE: JDK6 is formerly known as Project Mustang