Add catch.

This commit is contained in:
Mike 2020-06-07 02:58:38 +02:00
parent 5bd184a03a
commit 10f860dc0c

View File

@ -28,16 +28,21 @@ public class ModToolUserInfoComposer extends MessageComposer {
this.response.init(Outgoing.ModToolUserInfoComposer);
try {
int totalBans = 0;
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT COUNT(*) AS amount FROM bans WHERE user_id = ?")) {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection();
PreparedStatement statement = connection.prepareStatement("SELECT COUNT(*) AS amount FROM bans WHERE user_id = ?")) {
statement.setInt(1, this.set.getInt("user_id"));
try (ResultSet set = statement.executeQuery()) {
if (set.next()) {
totalBans = set.getInt("totalBans");
}
} catch (SQLException e) {
LOGGER.error("Caught SQL exception", e);
}
} catch (SQLException e) {
LOGGER.error("Caught SQL exception", e);
}
this.response.appendInt(this.set.getInt("user_id"));
this.response.appendString(this.set.getString("username"));
this.response.appendString(this.set.getString("look"));