Security - if any Throwable is thrown on initialization AuthMe should shut down

- Found via #1149
This commit is contained in:
ljacqu 2017-03-27 21:41:35 +02:00
parent 7d17608a0b
commit 2070f22968
2 changed files with 7 additions and 7 deletions

View File

@ -137,9 +137,9 @@ public class AuthMe extends JavaPlugin {
// Initialize the plugin // Initialize the plugin
try { try {
initialize(); initialize();
} catch (Exception e) { } catch (Throwable th) {
ConsoleLogger.logException("Aborting initialization of AuthMe:", e); ConsoleLogger.logException("Aborting initialization of AuthMe:", th);
OnStartupTasks.displayLegacyJarHint(e); OnStartupTasks.displayLegacyJarHint(th);
stopOrUnload(); stopOrUnload();
return; return;
} }

View File

@ -127,11 +127,11 @@ public class OnStartupTasks {
* Displays a hint to use the legacy AuthMe JAR if AuthMe could not be started * Displays a hint to use the legacy AuthMe JAR if AuthMe could not be started
* because Gson was not found. * because Gson was not found.
* *
* @param e the exception to process * @param th the Throwable to process
*/ */
public static void displayLegacyJarHint(Exception e) { public static void displayLegacyJarHint(Throwable th) {
if (e instanceof InjectorReflectionException) { if (th instanceof InjectorReflectionException) {
Throwable causeOfCause = Optional.of(e) Throwable causeOfCause = Optional.of(th)
.map(Throwable::getCause) .map(Throwable::getCause)
.map(Throwable::getCause).orElse(null); .map(Throwable::getCause).orElse(null);
if (causeOfCause instanceof NoClassDefFoundError if (causeOfCause instanceof NoClassDefFoundError