JDK-8173943 : Change error reporting of LauncherHelper to include actual Error class name
  • Type: Bug
  • Component: tools
  • Sub-Component: launcher
  • Affected Version: 9
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2017-02-05
  • Updated: 2017-02-23
  • Resolved: 2017-02-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10 JDK 9
10Fixed 9 b157Fixed
Related Reports
Relates :  
Description
Error reporting for LinkageError in LauncherHelper.java which was introduced by JDK-8167063, needs to be changed to include the actual Error class(sub-class of LinkageError) name instead of just stating LinkageError occurred and giving the error message.
This will help to-
- Identify the exact Error occurred like ClassFormatError, VerifyError etc...
- Avoid any code/tests to fail which checks the error message along with the class name.
Comments
Webrev: http://cr.openjdk.java.net/~rpatil/8173943/webrev.00/ Public Review Thread: http://mail.openjdk.java.net/pipermail/core-libs-dev/2017-February/046253.html
06-02-2017

Here is the sample error output for comparison(taken from the test case of JDK-8167063): 1. Before Fixing JDK-8167063: Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.IllegalAccessError: superclass access check failed: class pkg.b.Bar (in module mod.b) cannot access class pkg.a.Foo (in module mod.a) because module mod.a does not export pkg.a to module mod.b at java.lang.ClassLoader.defineClass1(java.base@9-ea/Native Method) at java.lang.ClassLoader.defineClass(java.base@9-ea/ClassLoader.java:947) at java.lang.ClassLoader.defineClass(java.base@9-ea/ClassLoader.java:1024) at java.security.SecureClassLoader.defineClass(java.base@9-ea/SecureClassLoader.java:182) at jdk.internal.loader.BuiltinClassLoader.defineClass(java.base@9-ea/BuiltinClassLoader.java:512) at jdk.internal.loader.BuiltinClassLoader.lambda$findClassInModuleOrNull$2(java.base@9-ea/BuiltinClassLoader.java:449) at java.security.AccessController.doPrivileged(java.base@9-ea/Native Method) at jdk.internal.loader.BuiltinClassLoader.findClassInModuleOrNull(java.base@9-ea/BuiltinClassLoader.java:450) at jdk.internal.loader.BuiltinClassLoader.findClass(java.base@9-ea/BuiltinClassLoader.java:354) at java.lang.ClassLoader.loadLocalClass(java.base@9-ea/ClassLoader.java:536) at java.lang.Class.forName(java.base@9-ea/Class.java:446) at sun.launcher.LauncherHelper.loadModuleMainClass(java.base@9-ea/LauncherHelper.java:544) at sun.launcher.LauncherHelper.checkAndLoadMain(java.base@9-ea/LauncherHelper.java:496) 2. After Fixing JDK-8167063: Error: Unable to load main class pkgB.ClassB from module mod.b superclass access check failed: class pkgB.ClassB (in module mod.b) cannot access class pkgA.ClassA (in module mod.a) because module mod.a does not export pkgA to module mod.b [Here the complete stacktrace was removed to be consistent with the error handling mechanism of LauncherHelper, where only the important error message is printed and the complete stack trace is shown in diagnostic ("-Xdiag") mode.] 3. After fixing the current Bug( JDK-8173943 ): Error: Unable to load main class pkgB.ClassB from module mod.b java.lang.IllegalAccessError: superclass access check failed: class pkgB.ClassB (in module mod.b) cannot access class pkgA.ClassA (in module mod.a) because module mod.a does not export pkgA to module mod.b
06-02-2017