--- a/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java Thu May 25 11:54:42 2017 +0100
+++ b/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java Thu May 25 10:40:08 2017 -0700
@@ -568,7 +568,6 @@
}
validateMainClass(mainClass);
-
return mainClass;
}
@@ -619,7 +618,7 @@
}
} catch (LinkageError le) {
abort(null, "java.launcher.module.error3", mainClass, m.getName(),
- le.getClass().getName() + ": " + le.getLocalizedMessage());
+ le.getClass().getName() + ": " + le.getLocalizedMessage());
}
if (c == null) {
abort(null, "java.launcher.module.error2", mainClass, mainModule);
@@ -707,14 +706,22 @@
// Check the existence and signature of main and abort if incorrect
static void validateMainClass(Class<?> mainClass) {
- Method mainMethod;
+ Method mainMethod = null;
try {
mainMethod = mainClass.getMethod("main", String[].class);
} catch (NoSuchMethodException nsme) {
// invalid main or not FX application, abort with an error
abort(null, "java.launcher.cls.error4", mainClass.getName(),
JAVAFX_APPLICATION_CLASS_NAME);
- return; // Avoid compiler issues
+ } catch (Throwable e) {
+ if (mainClass.getModule().isNamed()) {
+ abort(e, "java.launcher.module.error5",
+ mainClass.getName(), mainClass.getModule(),
+ e.getClass().getName(), e.getLocalizedMessage());
+ } else {
+ abort(e,"java.launcher.cls.error7", mainClass.getName(),
+ e.getClass().getName(), e.getLocalizedMessage());
+ }
}
/*