Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8010924

Dealing with undefined property gets you a fatal stack

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • P2
    • Resolution: Fixed
    • None
    • 8
    • core-libs
    • b86
    • Verified

    Description

      This occurs in the context of nodejar. As soon as a script manipulates an undefined property it gets a fatal exception.

      I have isolated to be the conjunction of nashorn:mozilla_compact script being loaded from a script being evaluated from nashorn engine.

      Same script executed from nashorn shell works fine.

      Run the attached testcase (nb project) to reproduce.

      Exception in thread "main" javax.script.ScriptException: ReferenceError: "toto" is not defined in nashorn:mozilla_compat.js at line number 60
      at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:421)
      at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:405)
      at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:384)
      at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:135)
      at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
      at testnash.TestNash.main(TestNash.java:20)
      Caused by: nashorn:mozilla_compat.js:60 ReferenceError: "toto" is not defined
      at jdk.nashorn.internal.runtime.ECMAErrors.error(ECMAErrors.java:66)
      at jdk.nashorn.internal.runtime.ECMAErrors.referenceError(ECMAErrors.java:328)
      at jdk.nashorn.internal.runtime.ECMAErrors.referenceError(ECMAErrors.java:300)
      at jdk.nashorn.api.scripting.NashornScriptEngine.__noSuchProperty__(NashornScriptEngine.java:247)
      at jdk.nashorn.internal.scripts.Script$engine._L36(nashorn:engine/resources/engine.js:38)
      at jdk.nashorn.internal.scripts.Script$\=nashorn\!mozilla_compat._L47$_L51(nashorn:mozilla_compat.js:60)
      at jdk.nashorn.internal.scripts.Script$\^eval\_.runScript(<eval>:3)
      at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:510)
      at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:205)
      at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:345)
      at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:402)

      Attachments

        Activity

          People

            sundar Sundararajan Athijegannathan
            jfdenise Jean-Francois Denise (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: