Marashal Exception

Mark A. Johnson mark at redpt.com
Mon May 4 12:36:36 PDT 2009


This discussion has to do with old bugs that were reported in previous 
versions of the JRE:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5036554

and

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4712731

Specifically, the TCUtility.unmarshalIn() call fails on aliased type codes.

We have been using a 1.4 JRE for several years now because of this 
issue.  For some reason, this was fixed in the 1.4 code but lost in Java 
5 and Java 6.

The fix for the bug seems to be suggested in bug 4712731 above.  I have 
modified AnyImpl.java per the suggestion and patched my production Java 
6 JRE, and the fix seems to work correctly with our code.

As background, we are using omniORB, currently version 4.1.3.

So my questions are:

1.  Does this fix appear correct?  Are there cases that would not work, 
or will this break something else?
2.  Is it possible to get this fix into a future release?

Thanks in advance
Mark


Below is the modified code:

    public void read_value(org.omg.CORBA.portable.InputStream in, 
TypeCode tc)
    {
        //debug.log ("read_value");
        //
        // Assume that someone isn't going to think they can keep reading
        // from this stream after calling us. That would be likely for
        // an IIOPInputStream but if it is an AnyInputStream then they
        // presumably obtained it via our create_output_stream() so they 
could
        // write the contents of an IDL data type to it and then call
        // create_input_stream() for us to read it. This is how Helper 
classes
        // typically implement the insert() method.
        // We should probably document this behavior in the 1.1 revision
        // task force.
        //

        typeCode = TypeCodeImpl.convertToNative(orb, tc);
        int kind = realType().kind().value();
        if (kind >= isStreamed.length) {
            throw wrapper.invalidIsstreamedTckind( 
CompletionStatus.COMPLETED_MAYBE,
                new Integer(kind)) ;
        }

        if (AnyImpl.isStreamed[kind]) {
            if ( in instanceof AnyInputStream ) {
                // could only have been created here
                stream = (CDRInputStream)in;
            } else {
                org.omg.CORBA_2_3.portable.OutputStream out =
                    
(org.omg.CORBA_2_3.portable.OutputStream)orb.create_output_stream();
                
typeCode.copy((org.omg.CORBA_2_3.portable.InputStream)in, out);
                stream = (CDRInputStream)out.create_input_stream();
            }
        } else {
            java.lang.Object[] objholder = new java.lang.Object[1];
            objholder[0] = object;
            long[] longholder = new long[1];
            //TCUtility.unmarshalIn(in, typeCode, longholder, objholder);
            TCUtility.unmarshalIn(in, realType(), longholder, 
objholder);        <----------------------------------------- change
            value = longholder[0];
            object = objholder[0];
            stream = null;
        }
        isInitialized = true;
    }





More information about the net-dev mailing list