Properly close DB objects once PP migration is complete

This commit is contained in:
Luck 2016-08-22 17:01:41 +01:00
parent f7baf67985
commit cd9f18ffdb
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B

View File

@ -111,7 +111,7 @@ public class MigrationPowerfulPerms extends SubCommand<Object> {
// Find a list of UUIDs // Find a list of UUIDs
log.info("PowerfulPerms Migration: Getting a list of UUIDs to migrate."); log.info("PowerfulPerms Migration: Getting a list of UUIDs to migrate.");
HikariDataSource hikari = new HikariDataSource(); @Cleanup HikariDataSource hikari = new HikariDataSource();
hikari.setMaximumPoolSize(2); hikari.setMaximumPoolSize(2);
hikari.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource"); hikari.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource");
hikari.addDataSourceProperty("serverName", address.split(":")[0]); hikari.addDataSourceProperty("serverName", address.split(":")[0]);
@ -133,7 +133,7 @@ public class MigrationPowerfulPerms extends SubCommand<Object> {
} else { } else {
@Cleanup PreparedStatement preparedStatement = connection.prepareStatement("SELECT `uuid` FROM " + dbTable); @Cleanup PreparedStatement preparedStatement = connection.prepareStatement("SELECT `uuid` FROM " + dbTable);
ResultSet resultSet = preparedStatement.executeQuery(); @Cleanup ResultSet resultSet = preparedStatement.executeQuery();
while (resultSet.next()) { while (resultSet.next()) {
uuids.add(UUID.fromString(resultSet.getString("uuid"))); uuids.add(UUID.fromString(resultSet.getString("uuid")));