|
Quick Lists
|
|
Bug ID:
|
4730878
|
|
Votes
|
0
|
|
Synopsis
|
PortableRemoteObject.narrow(...) should not cast result to java.rmi.Remote
|
|
Category
|
idl:orb
|
|
Reported Against
|
mantis
|
|
Release Fixed
|
1.3.1(1.3.1_07)
|
|
State
|
11-Closed,
Unverified,
bug
|
|
Priority:
|
3-Medium
|
|
Related Bugs
|
|
|
Submit Date
|
13-AUG-2002
|
|
Description
|
com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(...) casts the returned result to the java.rmi.Remote interface.
This doesn't work in all cases. The incorrect code (see the two lines below) is inside com.sun.corba.se.internal.util.Utility.loadStub(...). The narrow method calls this loadStub method to create a stub.
// Create a stub instance and set the delegate...
result = (Remote) resultClass.newInstance();
This behavior is contradiciting the spec of javax.rmi.PortableRemoteObject.narrow(...): "Checks to ensure that an object of a remote or abstract interface type can be cast to a desired type"
Since the abstract interfaces do not implement Remote, this code will break for customers using abstract interfaces in their application. This code results in ClassCastException like the following one:
java.lang.ClassCastException: Bank._Account_Stub
at com.sun.corba.se.internal.util.Utility.loadStub(Utility.java:754)
at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:287)
at javax.rmi.PortableRemoteObject.narrow(Unknown Source)
at Bank._AccountManager_Stub.create(_AccountManager_Stub.java:109)
at ClientApplet.action(ClientApplet.java:91)
at java.awt.Component.handleEvent(Unknown Source)
at java.awt.Component.postEvent(Unknown Source)
at java.awt.Component.postEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
This code fails for customer Borland. Borland believes that the result should be cast to javax.rmi.CORBA.Stub (spec defined stub base) (loadStub's return type should be modified too).
|
|
Work Around
|
N/A
|
|
Evaluation
|
Will fix it for 1.4.2 since it is too late for 1.4.1 and also, it may go in 1.3.1 and 1.4.0 patches.
|
|
Comments
|
Submitted On 13-MAR-2006
ayyappan13
Pls let me know whether this bud was fixed or not
Submitted On 28-APR-2006
Senthil.Pillai
I work with 1.4.2_07 JRE, still i get this exception. Any pointers to solve this problem.
Submitted On 28-APR-2006
Senthil.Pillai
I work with 1.4.2_07 JRE, still i get this exception. Any pointers to solve this problem.
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |