RFR: 8167063: spurious message "A JNI error has occurred" if start-class cannot be initialized
Alan Bateman
Alan.Bateman at oracle.com
Fri Jan 20 14:32:48 UTC 2017
On 20/01/2017 13:21, Ramanand Patil wrote:
> Hi all,
> Please review the following bug fix:
> Bug: https://bugs.openjdk.java.net/browse/JDK-8167063
> Webrev: http://cr.openjdk.java.net/~rpatil/8167063/webrev.00/
>
> Handled the SecurityException and LinkageError which can be thrown from Class.forName(...) method used in LauncherHelper.java and added corresponding error messages to launcher.properties.
> Though the reported bug is because of the LinkageError, Security exception is also handled to be safe from calling Class.forName method.
>
I see this changes loadMainClass to abort with resources that are keyed
on java.launcher.cls.error6 and java.launcher.cls.error7 but they don't
appear in the launcher.properties file. Does this work? I would assume
MissingResourceException is thrown.
For java.launcher.module.error3 and java.launcher.module.error4 then
"link" is likely to confuse people. Sure, there may be linkage errors
but there are many linkage errors and I think would be a lot clearer if
the message was "Unable to load main class {0} from module {1}\n\{2}".
It's not clear to me that having a different message for security
exceptions make sense, esp. when the exception is printed. So I think I
would drop that.
Also loadModuleMainClass0 is unusual method name, we've mostly (not
always) used the 0 suffix on native methods. In any case, it doesn't
look like it is needed, the code was okay in loadModuleMainClass as it was.
One final point is that is the nesting catching of LinkageError and
SecurityException in loadMainClass, I assume you don't need the inner catch.
-Alan
More information about the core-libs-dev
mailing list