JDK-8029364 : NashornException to expose thrown object
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: jdk.nashorn
  • Affected Version: 8u20
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2013-11-29
  • Updated: 2014-07-29
  • Resolved: 2014-01-14
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.
JDK 8 JDK 9
8u20Fixed 9 b02Fixed
Description
It would be very useful to retrieve the ScriptObjectMirror, Java Exception or any other throwable type.
There is no way to retrieve this informationt without using internal API.

ECMAException ecma = (ECMAException) nex;
if (ecma.getThrown() instanceof ScriptObject) {
  ScriptObject so = (ScriptObject) ecma.getThrown();
  for (String m : so.getOwnKeys(false)) {
   // XXX
  }
}
Comments
Fix pushed to nashorn-jdk9 forest: changeset: 681:dcca148a8219 tag: tip user: sundar date: Mon Dec 02 18:19:26 2013 +0530 summary: 8029364: NashornException to expose thrown object Webrev here: http://cr.openjdk.java.net/~sundar/8029364/
02-12-2013