JDK-8164748 : Edit pad crashes when calling function
  • Type: Bug
  • Component: core-libs
  • Sub-Component: jdk.nashorn
  • Affected Version: 9
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2016-08-24
  • Updated: 2016-09-02
  • Resolved: 2016-08-25
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 9
9 b134Fixed
Description
Run the enclosed script as 

jjs -scripting -doe --language=es6 forms.js -

Then edit(,  paste and accept:

box(5, 5, <<EOM);
This call to the box function
causes an NPE
EOM



java.lang.NullPointerException
java.lang.NullPointerException
	at jdk.nashorn.internal.runtime.Context.getContext(jdk.scripting.nashorn@9-internal/Context.java:1376)
	at jdk.nashorn.internal.runtime.Context.getContextTrusted(jdk.scripting.nashorn@9-internal/Context.java:1288)
	at jdk.nashorn.internal.runtime.RecompilableScriptFunctionData.createLogger(jdk.scripting.nashorn@9-internal/RecompilableScriptFunctionData.java:1047)
	at jdk.nashorn.internal.runtime.RecompilableScriptFunctionData.<init>(jdk.scripting.nashorn@9-internal/RecompilableScriptFunctionData.java:184)
	at jdk.nashorn.internal.codegen.FindScopeDepths.leaveFunctionNode(jdk.scripting.nashorn@9-internal/FindScopeDepths.java:211)
	at jdk.nashorn.internal.ir.FunctionNode.accept(jdk.scripting.nashorn@9-internal/FunctionNode.java:405)
	at jdk.nashorn.internal.ir.LexicalContextNode$Acceptor.accept(jdk.scripting.nashorn@9-internal/LexicalContextNode.java:57)
	at jdk.nashorn.internal.ir.LexicalContextExpression.accept(jdk.scripting.nashorn@9-internal/LexicalContextExpression.java:47)
	at jdk.nashorn.internal.ir.FunctionNode.accept(jdk.scripting.nashorn@9-internal/FunctionNode.java:57)
	at jdk.nashorn.internal.codegen.CompilationPhase.transformFunction(jdk.scripting.nashorn@9-internal/CompilationPhase.java:634)
	at jdk.nashorn.internal.codegen.CompilationPhase.access$100(jdk.scripting.nashorn@9-internal/CompilationPhase.java:55)
	at jdk.nashorn.internal.codegen.CompilationPhase$ScopeDepthComputationPhase.transform(jdk.scripting.nashorn@9-internal/CompilationPhase.java:207)
	at jdk.nashorn.internal.codegen.CompilationPhase.apply(jdk.scripting.nashorn@9-internal/CompilationPhase.java:630)
	at jdk.nashorn.internal.codegen.Compiler.compile(jdk.scripting.nashorn@9-internal/Compiler.java:656)
	at jdk.nashorn.internal.runtime.Context.compile(jdk.scripting.nashorn@9-internal/Context.java:1529)
	at jdk.nashorn.internal.runtime.Context.eval(jdk.scripting.nashorn@9-internal/Context.java:813)
	at jdk.nashorn.internal.runtime.Context.eval(jdk.scripting.nashorn@9-internal/Context.java:781)
	at jdk.nashorn.tools.jjs.Main.evalImpl(jdk.scripting.nashorn.shell@9-internal/Main.java:272)
	at jdk.nashorn.tools.jjs.Main.lambda$readEvalPrint$2(jdk.scripting.nashorn.shell@9-internal/Main.java:180)
	at jdk.nashorn.tools.jjs.EditObject$SaveHandler.accept(jdk.scripting.nashorn.shell@9-internal/EditObject.java:107)
	at jdk.nashorn.tools.jjs.EditObject$SaveHandler.accept(jdk.scripting.nashorn.shell@9-internal/EditObject.java:94)
	at jdk.nashorn.tools.jjs.EditPad.lambda$buttons$1(jdk.scripting.nashorn.shell@9-internal/EditPad.java:98)
	at javax.swing.AbstractButton.fireActionPerformed(java.desktop@9-internal/AbstractButton.java:1967)
	at javax.swing.AbstractButton$Handler.actionPerformed(java.desktop@9-internal/AbstractButton.java:2308)
	at javax.swing.DefaultButtonModel.fireActionPerformed(java.desktop@9-internal/DefaultButtonModel.java:404)
	at javax.swing.DefaultButtonModel.setPressed(java.desktop@9-internal/DefaultButtonModel.java:261)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(java.desktop@9-internal/BasicButtonListener.java:269)
	at java.awt.Component.processMouseEvent(java.desktop@9-internal/Component.java:6601)
	at javax.swing.JComponent.processMouseEvent(java.desktop@9-internal/JComponent.java:3322)
	at java.awt.Component.processEvent(java.desktop@9-internal/Component.java:6366)
	at java.awt.Container.processEvent(java.desktop@9-internal/Container.java:2259)
	at java.awt.Component.dispatchEventImpl(java.desktop@9-internal/Component.java:4985)
	at java.awt.Container.dispatchEventImpl(java.desktop@9-internal/Container.java:2317)
	at java.awt.Component.dispatchEvent(java.desktop@9-internal/Component.java:4817)
	at java.awt.LightweightDispatcher.retargetMouseEvent(java.desktop@9-internal/Container.java:4896)
	at java.awt.LightweightDispatcher.processMouseEvent(java.desktop@9-internal/Container.java:4533)
	at java.awt.LightweightDispatcher.dispatchEvent(java.desktop@9-internal/Container.java:4474)
	at java.awt.Container.dispatchEventImpl(java.desktop@9-internal/Container.java:2303)
	at java.awt.Window.dispatchEventImpl(java.desktop@9-internal/Window.java:2754)
	at java.awt.Component.dispatchEvent(java.desktop@9-internal/Component.java:4817)
	at java.awt.EventQueue.dispatchEventImpl(java.desktop@9-internal/EventQueue.java:761)
	at java.awt.EventQueue.access$500(java.desktop@9-internal/EventQueue.java:97)
	at java.awt.EventQueue$3.run(java.desktop@9-internal/EventQueue.java:712)
	at java.awt.EventQueue$3.run(java.desktop@9-internal/EventQueue.java:706)
	at java.security.AccessController.doPrivileged(java.base@9-internal/Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(java.base@9-internal/ProtectionDomain.java:77)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(java.base@9-internal/ProtectionDomain.java:87)
	at java.awt.EventQueue$4.run(java.desktop@9-internal/EventQueue.java:734)
	at java.awt.EventQueue$4.run(java.desktop@9-internal/EventQueue.java:732)
	at java.security.AccessController.doPrivileged(java.base@9-internal/Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(java.base@9-internal/ProtectionDomain.java:77)
	at java.awt.EventQueue.dispatchEvent(java.desktop@9-internal/EventQueue.java:731)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(java.desktop@9-internal/EventDispatchThread.java:199)
	at java.awt.EventDispatchThread.pumpEventsForFilter(java.desktop@9-internal/EventDispatchThread.java:124)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(java.desktop@9-internal/EventDispatchThread.java:113)
	at java.awt.EventDispatchThread.pumpEvents(java.desktop@9-internal/EventDispatchThread.java:109)
	at java.awt.EventDispatchThread.pumpEvents(java.desktop@9-internal/EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.run(java.desktop@9-internal/EventDispatchThread.java:90)