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

bound java static method throws NPE when 'null' is used for this argument

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • None
    • core-libs
    • None
    • b44
    • generic
    • generic

        File: getjavahome.js

        getProp = java.lang.System.getProperty;
        getHome = Function.prototype.bind.call(getProp, null, "java.home");
        print(getHome()); // JAVA_HOME value expected


        Expected:

        JAVA_HOME is printed.

        Actual:

        Exception in thread "main" java.lang.NullPointerException
        at jdk.nashorn.internal.runtime.linker.BoundCallableLinker.getGuardedInvocation(BoundCallableLinker.java:102)
        at jdk.internal.dynalink.support.CompositeTypeBasedGuardingDynamicLinker.getGuardedInvocation(CompositeTypeBasedGuardingDynamicLinker.java:176)
        at jdk.internal.dynalink.support.CompositeGuardingDynamicLinker.getGuardedInvocation(CompositeGuardingDynamicLinker.java:124)
        at jdk.internal.dynalink.support.LinkerServicesImpl.getGuardedInvocation(LinkerServicesImpl.java:149)
        at jdk.internal.dynalink.DynamicLinker.relink(DynamicLinker.java:233)
        at jdk.nashorn.internal.scripts.Script$Recompilation$4$getjavahome$cu1$restOf.:program(getjavahome.js:3)
        at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:636)
        at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:636)
        at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:636)
        at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:636)
        at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:636)
        at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:229)
        at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:387)
        at jdk.nashorn.tools.Shell.apply(Shell.java:394)
        at jdk.nashorn.tools.Shell.runScripts(Shell.java:323)
        at jdk.nashorn.tools.Shell.run(Shell.java:169)
        at jdk.nashorn.tools.Shell.main(Shell.java:133)
        at jdk.nashorn.tools.Shell.main(Shell.java:112)

              sundar Sundararajan Athijegannathan
              sundar Sundararajan Athijegannathan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: