Skip to content

Commit

Permalink
add error message to sql exception
Browse files Browse the repository at this point in the history
  • Loading branch information
aurorasmiles committed Jul 24, 2019
1 parent 94bacdd commit 668cd3e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Expand Up @@ -2,13 +2,13 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.alpenblock</groupId>
<artifactId>BungeePerms</artifactId>
<version>3.0</version>
<version>4.0</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<build.major>3.0</build.major>
<build.major>${project.version}</build.major>
<build.type>SNAPSHOT</build.type>
<build.number>1</build.number>
<build.fullversion.file>${build.major}-${build.type}-${build.number}</build.fullversion.file>
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/net/alpenblock/bungeeperms/Mysql.java
Expand Up @@ -48,6 +48,13 @@ public void connect()
String url = "jdbc:mysql://" + config.getString(configsection + ".general.mysqlhost", "localhost") + ":" + config.getString(configsection + ".general.mysqlport", "3306") + "/" + config.getString(configsection + ".general.mysqldb", "database") + "?autoReconnect=true&dontTrackOpenResources=true";
this.connection = DriverManager.getConnection(url, config.getString(configsection + ".general.mysqluser", configsection), config.getString(configsection + ".general.mysqlpw", "password"));
}
catch (SQLException e) {
if (e.getCause() != null && e.getCause().getMessage().startsWith("Access denied for user")) {
BungeePerms.getInstance().getPlugin().getLogger().severe("Failed to connect to database: " + e.getMessage());
} else {
debug.log(e);
}
}
catch (Exception e)
{
debug.log(e);
Expand All @@ -56,9 +63,9 @@ public void connect()

public void close()
{
BungeePerms.getInstance().getPlugin().getLogger().info("Disconnecting from database");
if (this.connection != null)
{
BungeePerms.getInstance().getPlugin().getLogger().info("Disconnecting from database");
try
{
if (isConnected())
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
@@ -1,7 +1,7 @@
name: BungeePerms
main: net.alpenblock.bungeeperms.platform.bukkit.BukkitPlugin
version: '${build.fullversion.resource}'
author: wea_ondara
author: [wea_ondara, AuroraRainbow]
load: startup

commands:
Expand Down

0 comments on commit 668cd3e

Please sign in to comment.