diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/misc/InfoCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/misc/InfoCommand.java index 73b5493ba..ab6437af2 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/misc/InfoCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/misc/InfoCommand.java @@ -49,6 +49,8 @@ public class InfoCommand extends SingleCommand { @Override public CommandResult execute(LuckPermsPlugin plugin, Sender sender, List args, String label) { + Map storageMeta = plugin.getStorage().getMeta(); + Message.INFO_TOP.send(sender, plugin.getBootstrap().getVersion(), plugin.getBootstrap().getType().getFriendlyName(), @@ -57,7 +59,7 @@ public class InfoCommand extends SingleCommand { ); Message.INFO_STORAGE.send(sender, plugin.getStorage().getName()); - for (Map.Entry e : plugin.getStorage().getMeta().entrySet()) { + for (Map.Entry e : storageMeta.entrySet()) { Message.INFO_STORAGE_META.send(sender, e.getKey(), formatValue(e.getValue())); } diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/connection/hikari/HikariConnectionFactory.java b/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/connection/hikari/HikariConnectionFactory.java index 03adf4eb1..2e1d60494 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/connection/hikari/HikariConnectionFactory.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/connection/hikari/HikariConnectionFactory.java @@ -36,6 +36,7 @@ import java.sql.SQLException; import java.sql.Statement; import java.util.LinkedHashMap; import java.util.Map; +import java.util.Objects; public abstract class HikariConnectionFactory implements ConnectionFactory { @@ -103,7 +104,7 @@ public abstract class HikariConnectionFactory implements ConnectionFactory { boolean success = true; long start = System.currentTimeMillis(); - try (Connection c = this.hikari.getConnection()) { + try (Connection c = getConnection()) { try (Statement s = c.createStatement()) { s.execute("/* ping */ SELECT 1"); } @@ -124,9 +125,12 @@ public abstract class HikariConnectionFactory implements ConnectionFactory { @Override public Connection getConnection() throws SQLException { + if (this.hikari == null) { + throw new SQLException("Unable to get a connection from the pool. (hikari is null)"); + } Connection connection = this.hikari.getConnection(); if (connection == null) { - throw new SQLException("Unable to get a connection from the pool."); + throw new SQLException("Unable to get a connection from the pool. (getConnection returned null)"); } return connection; }