United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4911077 : javax.rmi.CORBA.Util.isLocal(stub) restricts custom ORB

Details
Type:
Bug
Submit Date:
2003-08-22
Status:
Closed
Updated Date:
2005-04-22
Project Name:
JDK
Resolved Date:
2004-12-10
Component:
other-libs
OS:
linux_redhat_9.0,generic,windows_2000
Sub-Component:
corba:orb
CPU:
x86,generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
8.0pe,1.3.1,1.4.2
Fixed Versions:
1.4.2 (04)

Related Reports
Backport:
Duplicate:

Sub Tasks

Description
Hello All,

My ISV experienced one problem related to Sun CORBA Util Implementation
I tested it under jdk1.3, it works fine
but it fails on jdk1.4.2.

For test on jdk1.3 you need some jar files from ISV(or me) and some jar files
from j2sdk1.4.2/jre/lib

For test on jdk1.4 you only need some jar files from ISV(or me)
you will see a ClassCastException. it seems customer implemented Stub class
is not accept by javax.rmi.CORBA.Util.isLocal(Stub stub) method on jdk1.4.2
although it works fine on jdk1.3.

                                    

Comments
SUGGESTED FIX

src/share/classes/com/sun/corba/se/internal/iiop/ShutdownUtilDelegate.java
39c39,42
< 	    return ((ClientSubcontract)delegate).useLocalInvocation( stub ) ;
---
>             if (delegate instanceof ClientSubcontract)
> 	       return ((ClientSubcontract)delegate).useLocalInvocation( stub ) ;
>             else
>                return delegate.is_local( stub );

###@###.### 2003-10-14
                                     
2003-10-14
EVALUATION

The delegate returned by stub._get_delegate() may not always be a 
ClientSubcontract ( Sun's ORB delegate ) so check to see if it is an instanceof
of ClientSubcontract before casting. If not is must be a 
org.omg.CORBA.portable.Delegate so simply call is_local.

###@###.### 2003-10-14
-----------------------------------------
                                     
2003-10-14
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
1.4.2_04
tiger-beta

FIXED IN:
1.4.2_04
tiger-beta

INTEGRATED IN:
1.4.2_04
tiger-beta


                                     
2004-06-14
WORK AROUND

create a simple class that extends Util and overrides isLocal(Stub stub)

  import javax.rmi.CORBA.Util;

  public class NewUtil extends Util
  {
      public static boolean isLocal(Stub stub) throws RemoteException {   

      try {
         org.omg.CORBA.portable.Delegate delegate = stub._get_delegate() ;
         return delegate.isLocal( stub ) ;
      } catch (SystemException e) {
         throw javax.rmi.CORBA.Util.mapSystemException(e);
      }

      return false;
  }

Then add the following default setting to your java command line
-Djavax.rmi.CORBA.UtilClass=NewUtil

###@###.### 2003-10-14

Since this bug is still being referenced, I'll update this even though
the bug is now closed.  The above workaround is wrong.  The correct 
class to extend in the Util DELEGATE, not the Util class itself 
(note the static method!).

The correct fix looks more like:

package test ;

import org.omg.CORBA.SystemException ;
import com.sun.corba.ee.spi.protocol.CorbaClientDelegate ;
import javax.rmi.CORBA.Util ;
import java.rmi.RemoteException ;

public class NewUtil extends com.sun.corba.se.internal.javax.rmi.CORBA.Util 
{
    public boolean isLocal( javax.rmi.CORBA.Stub stub ) throws RemoteException 
    {
	boolean result = false ;

	try {
	    org.omg.CORBA.portable.Delegate delegate = stub._get_delegate() ;
	    if (delegate instanceof CorbaClientDelegate) {
		result = super.isLocal( stub ) ;
	    } else {
		result = delegate.is_local( stub ) ;
	    }
	} catch (SystemException exc) {
	    throw javax.rmi.CORBA.Util.mapSystemException(exc) ;
	}

	return result ;
    }
}

Please note that this is ONLY needed for the ORB in JDK 1.4.2.
###@###.### 2005-04-22 18:28:38 GMT
                                     
2005-04-22



Hardware and Software, Engineered to Work Together