Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5067940

[CORBA!] POA WrongAdapter thrown on roundtrip between 1.5 and 1.4.2

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b01
    • CPU:
      x86, sparc
    • OS:
      solaris_9, windows_xp

      Description

      Name: gm110360 Date: 06/24/2004


      FULL PRODUCT VERSION :
      1.5.0-beta2-b51

      A DESCRIPTION OF THE PROBLEM :
      [ATTENTION: I filed this against RMI, actually this is against the ORB, but there is no combination to file a Tiger ORB bug]

      We're sending object references back and forth between server and client and need to be able to resolve them back to the servant.

      An object reference marshalled from 1.5 to 1.4.2 and back will trigger a WrongAdapter exception on POA#reference_to_servant. With the help of a debugger I think I traced it to different ORBVersions in ObjectKeyTemplateBase#equals.

      This both works 1.4.2 -> 1.4.2 and 1.5 -> 1.5

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      In order to have one test program, you need to put the old 1.4.2 orb into the bootclasspath:

      * extract 1.4.2 orb from rt.jar: jar xvf rt.jar com/sun/corba/se
      * make orb.jar: jar cvf orb.jar com/sun/corba/se

      compile test program and run:

      java -Xbootclasspath/p:orb.jar ORBInterop

      You may as well try two programs running under 1.5 and 1.4.2 respectively.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I would expect to see:

      Roundtrip J2SE 1.5 -> 1.4 -> 1.5 succeeded

      ACTUAL -
      Roundtrip J2SE 1.5 -> 1.4 -> 1.5 failed
      org.omg.PortableServer.POAPackage.WrongAdapter: IDL:omg.org/PortableServer/POA/WrongAdapter:1.0
      at com.sun.corba.se.impl.oa.poa.POAImpl.internalReferenceToId(POAImpl.java:484)
      at com.sun.corba.se.impl.oa.poa.POAImpl.reference_to_servant(POAImpl.java:1408)
      at ORBInterop.main(ORBInterop.java:39)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:582)
      at com.intellij.rt.execution.application.AppMain.main(Unknown Source)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      /*
       * Copyright (c) 2004 CoreMedia AG, Hamburg. All rights reserved.
       */

      import org.omg.CORBA.ORB;
      import org.omg.PortableServer.POA;
      import org.omg.PortableServer.Servant;

      import java.util.Properties;

      public class ORBInterop {
        public static void main(String[] args) throws Exception {
          Properties orbProperties_1_5 = new Properties();
          orbProperties_1_5.put("org.omg.CORBA.ORBClass", "com.sun.corba.se.impl.orb.ORBImpl");

          Properties orbProperties_1_4 = new Properties();
          orbProperties_1_4.put("org.omg.CORBA.ORBClass", "com.sun.corba.se.internal.iiop.ORB");

          ORB server = ORB.init(new String[0], orbProperties_1_5);
          ORB client_1_5 = ORB.init(new String[0], orbProperties_1_5);
          ORB client_1_4 = ORB.init(new String[0], orbProperties_1_4);


          POA poa = (POA) server.resolve_initial_references("RootPOA");
          poa.the_POAManager().activate();

          Servant servant = new Servant() {
            public String[] _all_interfaces(POA poa, byte[] objectId) {
      return new String[] { "IDL:test/Interface:1.0" };
            }
          };

          poa.activate_object(servant);

          roundtrip(server, poa, servant, client_1_5, "1.5 -> 1.5 -> 1.5");
          roundtrip(server, poa, servant, client_1_4, "1.5 -> 1.4 -> 1.5");
        }

        static void roundtrip(ORB server, POA poa, Servant servant, ORB client, String description) throws Exception {
          String serverIor = server.object_to_string(poa.servant_to_reference(servant));

          String clientIor = client.object_to_string(client.string_to_object(serverIor));
          try {
            if(servant == poa.reference_to_servant(server.string_to_object(clientIor)))
      System.out.println(description+": roundtrip succeeded");
            else
      System.out.println(description+": roundtrip succeeded, but servants differ");

          } catch(Exception e) {
            System.out.println(description+": roundtrip failed");
            e.printStackTrace();
          }
        }
      }

      ---------- END SOURCE ----------
      (Incident Review ID: 279763)
      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            hgodugusunw Harsha Godugu (Inactive)
            Reporter:
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: