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

jhat oql function "heap.forEachClass(...)" is broken

    Details

    • Subcomponent:
      svc
    • CPU:
      generic

      Description

      Steps to reproduce:
      - Start jhat with any hprof file
      - Open OQL query page
      - Enter query: "heap.forEachClass(function() { })"

      Output:
      java.lang.reflect.InvocationTargetException com.sun.tools.hat.internal.oql.OQLException: java.lang.reflect.InvocationTargetException
      at com.sun.tools.hat.internal.oql.OQLEngine.executeQuery(OQLEngine.java:95)
      at com.sun.tools.hat.internal.server.OQLQuery.executeQuery(OQLQuery.java:88)
      at com.sun.tools.hat.internal.server.OQLQuery.run(OQLQuery.java:80)
      at com.sun.tools.hat.internal.server.HttpReader.run(HttpReader.java:194)
      at java.lang.Thread.run(Thread.java:722)
      Caused by: java.lang.reflect.InvocationTargetException
      at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:487)
      at com.sun.tools.hat.internal.oql.OQLEngine.evalScript(OQLEngine.java:240)
      at com.sun.tools.hat.internal.oql.OQLEngine.executeQuery(OQLEngine.java:92)
      ... 4 more
      Caused by: javax.script.ScriptException: TypeError: java.util.Collections$UnmodifiableCollection$1@530d0c has no such function "hasMoreElements" in at line number 498
      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)
      ... 9 more
      Caused by: :498 TypeError: java.util.Collections$UnmodifiableCollection$1@530d0c has no such function "hasMoreElements"
      at jdk.nashorn.internal.runtime.ECMAErrors.error(ECMAErrors.java:66)
      at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:222)
      at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:194)
      at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:181)
      at jdk.nashorn.internal.runtime.linker.NashornBottomLinker.linkBean(NashornBottomLinker.java:93)
      at jdk.nashorn.internal.runtime.linker.NashornBottomLinker.getGuardedInvocation(NashornBottomLinker.java:64)
      at jdk.internal.dynalink.support.CompositeGuardingDynamicLinker.getGuardedInvocation(CompositeGuardingDynamicLinker.java:124)
      at jdk.internal.dynalink.support.LinkerServicesImpl.getGuardedInvocation(LinkerServicesImpl.java:138)
      at jdk.internal.dynalink.DynamicLinker.relink(DynamicLinker.java:229)
      at jdk.nashorn.internal.scripts.Script$\^eval\_.wrapHeapSnapshot$_L493(:498)
      at jdk.nashorn.internal.scripts.Script$\^eval\_.runScript(:1)
      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)
      ... 12 more


      This is likely due to an error in hat.js:495
           var classes = this.snapshot.classes;

      which should be
            var classes = this.classes();

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              allwin Peter Allwin (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: