JDK-8173862 : UnicastRemoteObject.exportObject throws wrong exception
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.rmi
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2017-02-03
  • Updated: 2018-09-11
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 Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Description
If the remote interface isn't accessible (e.g., it's in a package that isn't exported or open to the java.rmi module), the wrong exception is thrown.

The runtime throws InaccessibleObjectException from the call to setAccessible(). This occurs within UnicastServerRef.exportObject() within the call to hashToMethod_Maps.get(). This exception is propagated all the way out to the caller. Worse, this exception is thrown after the object is entered into the object table, so it has an entry for which no stub can be created.

USR.exportObject() should catch this exception and wrap it in a StubNotFoundException. It should also move the hashToMethod_Maps.get() call earlier, to preserve failure atomicity.