Codestyle cleanup

This commit is contained in:
sgdc3
2017-09-27 15:16:33 +02:00
parent 83b5a3d66d
commit 920e65c4f4
10 changed files with 15 additions and 14 deletions
@@ -430,8 +430,9 @@ public class SQLite implements DataSource {
try (PreparedStatement pst = con.prepareStatement(sql)) {
pst.setString(1, user);
try (ResultSet rs = pst.executeQuery()) {
if (rs.next())
if (rs.next()) {
return rs.getInt(col.IS_LOGGED) == 1;
}
}
} catch (SQLException ex) {
logSqlException(ex);
@@ -454,7 +455,7 @@ public class SQLite implements DataSource {
@Override
public void setUnlogged(String user) {
String sql = "UPDATE " + tableName + " SET " + col.IS_LOGGED + "=? WHERE LOWER(" + col.NAME + ")=?;";
if (user != null)
if (user != null) {
try (PreparedStatement pst = con.prepareStatement(sql)) {
pst.setInt(1, 0);
pst.setString(2, user);
@@ -462,6 +463,7 @@ public class SQLite implements DataSource {
} catch (SQLException ex) {
logSqlException(ex);
}
}
}
@Override
@@ -40,7 +40,7 @@ public class RakamakConverter implements Converter {
}
@Override
// TODO ljacqu 20151229: Restructure this into smaller portions
//TODO ljacqu 20151229: Restructure this into smaller portions
public void execute(CommandSender sender) {
boolean useIp = settings.getProperty(ConverterSettings.RAKAMAK_USE_IP);
String fileName = settings.getProperty(ConverterSettings.RAKAMAK_FILE_NAME);
@@ -49,7 +49,7 @@ public class XAuthConverter implements Converter {
sender.sendMessage("[AuthMe] xAuth plugin not found");
return;
}
// TODO ljacqu 20160702: xAuthDb is not used except for the existence check -- is this intended?
//TODO ljacqu 20160702: xAuthDb is not used except for the existence check -- is this intended?
File xAuthDb = new File(dataFolder.getParent(), makePath("xAuth", "xAuth.h2.db"));
if (!xAuthDb.exists()) {
sender.sendMessage("[AuthMe] xAuth H2 database not found, checking for MySQL or SQLite data...");
@@ -86,8 +86,9 @@ public class XAuthConverter implements Converter {
ps = conn.prepareStatement(sql);
ps.setInt(1, id);
rs = ps.executeQuery();
if (!rs.next())
if (!rs.next()) {
return null;
}
realPass = rs.getString("playername").toLowerCase();
} catch (SQLException e) {
xAuthLog.severe("Failed to retrieve name for account: " + id, e);
@@ -131,8 +132,9 @@ public class XAuthConverter implements Converter {
ps = conn.prepareStatement(sql);
ps.setInt(1, accountId);
rs = ps.executeQuery();
if (!rs.next())
if (!rs.next()) {
return null;
}
realPass = rs.getString("password");
} catch (SQLException e) {
xAuthLog.severe("Failed to retrieve password hash for account: " + accountId, e);