mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-27 20:57:35 +01:00
cleanup MySQL throws
This commit is contained in:
parent
6a8e581ba8
commit
51067498ea
@ -64,58 +64,29 @@ public class MySQL implements DataSource {
|
|||||||
// Set the connection arguments (and check if connection is ok)
|
// Set the connection arguments (and check if connection is ok)
|
||||||
try {
|
try {
|
||||||
this.setConnectionArguments();
|
this.setConnectionArguments();
|
||||||
} catch (ClassNotFoundException ne) {
|
} catch (RuntimeException e) {
|
||||||
ConsoleLogger.showError(ne.getMessage());
|
if (e instanceof IllegalArgumentException) {
|
||||||
|
ConsoleLogger.showError("Invalid database arguments! Please check your configuration!");
|
||||||
|
ConsoleLogger.showError("If this error persists, please report it to the developer! SHUTDOWN...");
|
||||||
|
throw new IllegalArgumentException(e);
|
||||||
|
}
|
||||||
|
if (e instanceof PoolInitializationException) {
|
||||||
|
ConsoleLogger.showError("Can't initialize database connection! Please check your configuration!");
|
||||||
|
ConsoleLogger.showError("If this error persists, please report it to the developer! SHUTDOWN...");
|
||||||
|
throw new PoolInitializationException(e);
|
||||||
|
}
|
||||||
ConsoleLogger.showError("Can't use the Hikari Connection Pool! Please, report this error to the developer! SHUTDOWN...");
|
ConsoleLogger.showError("Can't use the Hikari Connection Pool! Please, report this error to the developer! SHUTDOWN...");
|
||||||
this.close();
|
throw e;
|
||||||
if (Settings.isStopEnabled) {
|
|
||||||
AuthMe.getInstance().getServer().shutdown();
|
|
||||||
AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance());
|
|
||||||
} else {
|
|
||||||
AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance());
|
|
||||||
}
|
|
||||||
throw new ClassNotFoundException(ne.getMessage());
|
|
||||||
} catch (IllegalArgumentException ae) { // This means that there are problems with the hikaricp pool arguments!
|
|
||||||
ConsoleLogger.showError(ae.getMessage());
|
|
||||||
ConsoleLogger.showError("Invalid database arguments! Please check your configuration!");
|
|
||||||
ConsoleLogger.showError("If this error persists, please report it to the developer! SHUTDOWN...");
|
|
||||||
this.close();
|
|
||||||
if (Settings.isStopEnabled) {
|
|
||||||
AuthMe.getInstance().getServer().shutdown();
|
|
||||||
AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance());
|
|
||||||
} else {
|
|
||||||
AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance());
|
|
||||||
}
|
|
||||||
throw new IllegalArgumentException(ae);
|
|
||||||
} catch (PoolInitializationException ie) { // Can't initialize the connection pool!
|
|
||||||
ConsoleLogger.showError(ie.getMessage());
|
|
||||||
ConsoleLogger.showError("Can't connect to the MySql database! Please check your configuration!");
|
|
||||||
ConsoleLogger.showError("If this error persists, please report it to the developer! SHUTDOWN...");
|
|
||||||
this.close();
|
|
||||||
if (Settings.isStopEnabled) {
|
|
||||||
AuthMe.getInstance().getServer().shutdown();
|
|
||||||
AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance());
|
|
||||||
} else {
|
|
||||||
AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance());
|
|
||||||
}
|
|
||||||
throw new PoolInitializationException(ie);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize the database
|
// Initialize the database
|
||||||
try {
|
try {
|
||||||
this.setupConnection();
|
this.setupConnection();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
ConsoleLogger.showError(e.getMessage());
|
this.close();
|
||||||
ConsoleLogger.showError("Can't initialize the MySQL database... Please check your database settings in the config.yml file! SHUTDOWN...");
|
ConsoleLogger.showError("Can't initialize the MySQL database... Please check your database settings in the config.yml file! SHUTDOWN...");
|
||||||
ConsoleLogger.showError("If this error persists, please report it to the developer! SHUTDOWN...");
|
ConsoleLogger.showError("If this error persists, please report it to the developer! SHUTDOWN...");
|
||||||
this.close();
|
throw e;
|
||||||
if (Settings.isStopEnabled) {
|
|
||||||
AuthMe.getInstance().getServer().shutdown();
|
|
||||||
AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance());
|
|
||||||
} else {
|
|
||||||
AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance());
|
|
||||||
}
|
|
||||||
throw new SQLException(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user