JDK-5067940 : [CORBA!] POA WrongAdapter thrown on roundtrip between 1.5 and 1.4.2
  • Type: Bug
  • Status: Resolved
  • Resolution: Fixed
  • Component: other-libs
  • Sub-Component: corba:orb
  • Priority: P4
  • Affected Version: 5.0,5.0u2
  • OS: solaris_9,windows_xp
  • CPU: x86,sparc
  • Submit Date: 2004-06-24
  • Updated Date: 2014-02-27
  • Resolved Date: 2006-02-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
Other
1.4.2_12 b01Resolved
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) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
2004-09-27

EVALUATION We updated the ORB version to fix an interoperability problem with java.util.Date. We thought we had handled the version checking problem, but apparently there is a problem here. It is too late to fix this problem for Tiger, so it will need to go into a future release.
2004-09-27