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

[JVMCI] improve TranslatedException traces

XMLWordPrintable

    • b15

        The way TranslatedExceptions are currently printed can be very confusing. For example:

        Caused by: jdk.vm.ci.hotspot.TranslatedException: [java.lang.ClassNotFoundException: java.security.AccessControlException] access denied ("java.lang.RuntimePermission" "accessClassInPackage.sun.misc")
        at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)

        means that when translating an AccessControlException from the HotSpot heap to the libgraal heap, an AccessControlException instance could not be created in the libgraal heap as Class.forName("java.security.AccessControlException") failed (libgraal has very limited reflection). If this exception is raised while loading some other class, the ClassNotFoundException part of the exception trace can be very confusing.

        There's no need to show the reason a translation failed; only the name of original, non-instantiable exception class needs to be shown:

        Caused by: jdk.vm.ci.hotspot.TranslatedException[java.security.AccessControlException]: access denied ("java.lang.RuntimePermission" "accessClassInPackage.sun.misc")
        at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)

        By putting the original exception class name to the left of the ":" makes it clearer what is going on.

        https://github.com/graalvm/labs-openjdk-11/commit/79940e44f174601b3df0afcd992725ffea63f247

              kvn Vladimir Kozlov
              dnsimon Douglas Simon
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: