[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jacorb-bugs
Subject:    [jacorb-bugs] [Bug 229] New: Cannot encode Objects contained within structs
From:       bugzilla-daemon () inf ! fu-berlin ! de
Date:       2002-07-18 7:57:15
Message-ID: E17V69z-000814-00 () berners
[Download RAW message or body]

http://www.jacorb.org/cgi-bin/bugzilla/show_bug.cgi?id=229

           Summary: Cannot encode Objects contained within structs
           Product: JacORB
           Version: 1.4.0
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ORB
        AssignedTo: gerald.brose@acm.org
        ReportedBy: black@despammed.com
         QAContact: jacorb-bugs@lists.spline.inf.fu-berlin.de


This is bug 74 raised again because that problem was not entirely fixed.
The problem only appears to have been fixed for null Object references.

The following code demonstrates the problem.
(ActionImpl is a trivial servant implementation)

------------------------------
dummy.idl

   struct DummyIfc
   {
        Object val;
   };

--------------------
TestCodec.java


public class TestCodec
{
    public static void main(String[] args)
    {
        try
        {
            ORB orb = ORB.init(args, null);

            POA poa =POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
            POAManager manager = poa.the_POAManager();
            manager.activate();
            Servant servant = new ActionImpl();
            byte[] oid = poa.activate_object(servant);
            org.omg.CORBA.Object ref = poa.id_to_reference(oid);

            Any any = ORB.init().create_any();
            DummyIfcHelper.insert(any, new DummyIfc(ref));  //## must have ref
            CodecFactory cf = CodecFactoryHelper.narrow(
                orb.resolve_initial_references("CodecFactory"));
            byte majorEncoding = Byte.parseByte("1");
            byte minorEncoding = Byte.parseByte("0");
            Encoding encoding = new Encoding(ENCODING_CDR_ENCAPS.value,
                                             majorEncoding, minorEncoding);
            Codec codec = cf.create_codec(encoding);
            byte[] data = codec.encode_value(any);

            System.out.println ("Codec Test OK");
        }
        catch (Exception e)
        {
            System.err.println("FAILED: " + e);
            e.printStackTrace();
        }
    }
}

------------------------------------------

Generates the following output:

org.omg.CORBA.MARSHAL: Cannot use the singleton ORB to receive object
references, please initialize a full ORB instead.
        at org.jacorb.orb.CDRInputStream.read_Object(CDRInputStream.java:527)
        at org.jacorb.orb.CDRInputStream.read_value(CDRInputStream.java:1350)
        at org.jacorb.orb.CDRInputStream.read_value(CDRInputStream.java:1386)
        at org.jacorb.orb.Any.write_value(Any.java:911)
        at
org.jacorb.orb.portableInterceptor.Codec_CDR_1_0_Impl.encode_value(Codec_CDR_1_0_Impl.java:99)
        at TestCodec.main(TestCodec.java:38)
FAILED: org.omg.CORBA.INTERNAL: Cannot use the singleton ORB to receive object
references, please initialize a full ORB instead.
org.omg.CORBA.INTERNAL: Cannot use the singleton ORB to receive object
references, please initialize a full ORB instead.
        at org.jacorb.orb.Any.write_value(Any.java:918)
        at
org.jacorb.orb.portableInterceptor.Codec_CDR_1_0_Impl.encode_value(Codec_CDR_1_0_Impl.java:99)
        at TestCodec.main(TestCodec.java:38)



------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic