From cd9f18ffdb4d4bff645ce8e3e8770f669201317d Mon Sep 17 00:00:00 2001 From: Luck Date: Mon, 22 Aug 2016 17:01:41 +0100 Subject: [PATCH] Properly close DB objects once PP migration is complete --- .../migration/subcommands/MigrationPowerfulPerms.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationPowerfulPerms.java b/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationPowerfulPerms.java index 5ec3257d1..e0cf34fc7 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationPowerfulPerms.java +++ b/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationPowerfulPerms.java @@ -111,7 +111,7 @@ public class MigrationPowerfulPerms extends SubCommand { // Find a list of UUIDs log.info("PowerfulPerms Migration: Getting a list of UUIDs to migrate."); - HikariDataSource hikari = new HikariDataSource(); + @Cleanup HikariDataSource hikari = new HikariDataSource(); hikari.setMaximumPoolSize(2); hikari.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource"); hikari.addDataSourceProperty("serverName", address.split(":")[0]); @@ -133,7 +133,7 @@ public class MigrationPowerfulPerms extends SubCommand { } else { @Cleanup PreparedStatement preparedStatement = connection.prepareStatement("SELECT `uuid` FROM " + dbTable); - ResultSet resultSet = preparedStatement.executeQuery(); + @Cleanup ResultSet resultSet = preparedStatement.executeQuery(); while (resultSet.next()) { uuids.add(UUID.fromString(resultSet.getString("uuid")));