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
try {
initialize();
} catch (Exception e) {
ConsoleLogger.logException("Aborting initialization of AuthMe:", e);
OnStartupTasks.displayLegacyJarHint(e);
} catch (Throwable th) {
ConsoleLogger.logException("Aborting initialization of AuthMe:", th);
OnStartupTasks.displayLegacyJarHint(th);
stopOrUnload();
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
* because Gson was not found.
*
* @param e the exception to process
* @param th the Throwable to process
*/
public static void displayLegacyJarHint(Exception e) {
if (e instanceof InjectorReflectionException) {
Throwable causeOfCause = Optional.of(e)
public static void displayLegacyJarHint(Throwable th) {
if (th instanceof InjectorReflectionException) {
Throwable causeOfCause = Optional.of(th)
.map(Throwable::getCause)
.map(Throwable::getCause).orElse(null);
if (causeOfCause instanceof NoClassDefFoundError