JDK-8081603 : erroneous dot file generated from Nashorn --print-code
  • Type: Bug
  • Component: core-libs
  • Sub-Component: jdk.nashorn
  • Affected Version: 9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-06-01
  • Updated: 2015-09-29
  • Resolved: 2015-06-02
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
8u60Fixed 9 b68Fixed
Description
If an exception is raised during dot file generation, a catch message is inserted in the label of a graph node, followed by a line break. The dot processor interprets this as a string running past the EOL.

Example (the input is the JavaScript function "var f = function(a) { return a+4 }") - there is a hard line break after the three closing asterisks:

    L2 [id=L2, label="*** CATCH: jdk/nashorn/internal/runtime/UnwarrantedOptimismException ***
    L2 [bci=8]\lframe same1 UnwarrantedOptimismException\l\l    8     iconst_2\l    9     anewarray Object\l   12     aload 0\l   13     iload 1\l   14     invokedynamic populateArray([Object;Object;I)[Object;                  [static 'populateArrayBootstrap']\l   19     iconst_0\l   20     invokestatic Script$Recompilation$4$8I$\^shell\_.:getString$array(I)[String;\l   23     invokestatic RewriteException.create(UnwarrantedOptimismException;[Object;[String;)RewriteException;\l   26     athrow\l"]

Proposed solution: to make the text contained in the graph consistent with what the --print-code option outputs to the console, omit the catch message altogether.

Attached noreg-other label as this is debugging infrastructure.
Comments
As the catches are explicitly queried in NashornTextifier, the message should stay. The fix is to emit a proper line break that is compliant with the dot label format.
02-06-2015