Fix unclosed Statement object.

This commit is contained in:
DNx5 2015-12-02 06:36:41 +07:00
parent 35d73b2d4a
commit ee3fe45d7f

View File

@ -283,10 +283,9 @@ public class MySQL implements DataSource {
if (!rs.next()) { if (!rs.next()) {
return null; return null;
} }
String salt = !columnSalt.isEmpty() ? rs.getString(columnSalt) : ""; String salt = !columnSalt.isEmpty() ? rs.getString(columnSalt) : "";
int group = !salt.isEmpty() && !columnGroup.isEmpty() ? rs.getInt(columnGroup) : -1; int group = !salt.isEmpty() && !columnGroup.isEmpty() ? rs.getInt(columnGroup) : -1;
int id = rs.getInt(columnID);
pAuth = PlayerAuth.builder() pAuth = PlayerAuth.builder()
.name(rs.getString(columnName)) .name(rs.getString(columnName))
.realName(rs.getString(columnRealName)) .realName(rs.getString(columnRealName))
@ -301,11 +300,9 @@ public class MySQL implements DataSource {
.salt(salt) .salt(salt)
.groupId(group) .groupId(group)
.build(); .build();
if (Settings.getPasswordHash == HashAlgorithm.XENFORO) {
int id = rs.getInt(columnID);
rs.close(); rs.close();
pst.close(); pst.close();
if (Settings.getPasswordHash == HashAlgorithm.XENFORO) {
pst = con.prepareStatement("SELECT data FROM xf_user_authenticate WHERE " + columnID + "=?;"); pst = con.prepareStatement("SELECT data FROM xf_user_authenticate WHERE " + columnID + "=?;");
pst.setInt(1, id); pst.setInt(1, id);
rs = pst.executeQuery(); rs = pst.executeQuery();