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

JShell: user exception chained cause not retained

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9, 10, 11
    • Fix Version/s: 11
    • Component/s: tools
    • Subcomponent:
    • Resolved In Build:
      b08
    • Verification:
      Verified

      Description

      If I evaluate an expression which results in throwing an exception, and that exception has a cause, the cause is not included in the stack trace:

      jshell> $8.resolveConstantRef(MethodHandles.lookup())
      | java.lang.BootstrapMethodError thrown: bootstrap method initialization exception
      | at BootstrapMethodInvoker.invoke (BootstrapMethodInvoker.java:174)
      | at ConstantBootstraps.makeConstant (ConstantBootstraps.java:66)
      | at DynamicConstantRef.resolveConstantRef (DynamicConstantRef.java:308)
      | at (#22:1)

      This exception had a chained cause, but it wasn't displayed. (Its pretty hard to debug the above without the underlying cause.)

      -----------

      The cause is not propagated at initial interception in the execution engine. This requires changes in the user code execution, the execution SPI, the representation of exceptions on the stream, the handling of evaluation, the JShell API, and the jshell tool.

      -----------

      The existing jshell tool display format for exceptions was not designed with chained exceptions in mind. It is not superior to that used by printStackTrace() and the JVM. Consistency with these is useful for transitioning. So, the jshell tool will use the standard format (which handles chained exceptions).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                rfield Robert Field
                Reporter:
                rfield Robert Field
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: