Commit f6306203 authored by Greg Thomas's avatar Greg Thomas

Rework commit to make diff clearer

parent 9acf53b8
...@@ -116,19 +116,30 @@ public class JDBCAdminProvider implements AdminProvider { ...@@ -116,19 +116,30 @@ public class JDBCAdminProvider implements AdminProvider {
List<JID> jids = new ArrayList<>(); List<JID> jids = new ArrayList<>();
synchronized (getAdminsSQL) { synchronized (getAdminsSQL) {
try { try {
con = getConnection(); con = getConnection();
pstmt = con.prepareStatement(getAdminsSQL); pstmt = con.prepareStatement(getAdminsSQL);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) { while (rs.next()) {
String name = rs.getString(1); String name = rs.getString(1);
jids.add(new JID(name + "@" + xmppDomain)); jids.add(new JID(name + "@" + xmppDomain));
}
return jids;
} catch (SQLException e) {
throw new RuntimeException(e);
} finally {
DbConnectionManager.closeConnection(rs, pstmt, con);
}
}
}
private void changeAdmins(final Connection con, final String sql, final List<JID> admins) throws SQLException {
if (!admins.isEmpty()) {
try (final PreparedStatement pstmt = con.prepareStatement(sql)) {
for (final JID jid : admins) {
pstmt.setString(1, jid.getNode());
pstmt.execute();
} }
return jids;
} catch (SQLException e) {
throw new RuntimeException(e);
} finally {
DbConnectionManager.closeConnection(rs, pstmt, con);
} }
} }
} }
...@@ -156,17 +167,6 @@ public class JDBCAdminProvider implements AdminProvider { ...@@ -156,17 +167,6 @@ public class JDBCAdminProvider implements AdminProvider {
} }
} }
private void changeAdmins(final Connection con, final String sql, final List<JID> admins) throws SQLException {
if (!admins.isEmpty()) {
try (final PreparedStatement pstmt = con.prepareStatement(sql)) {
for (final JID jid : admins) {
pstmt.setString(1, jid.getNode());
pstmt.execute();
}
}
}
}
@Override @Override
public boolean isReadOnly() { public boolean isReadOnly() {
return insertAdminsSQL.isEmpty() || deleteAdminsSQL.isEmpty(); return insertAdminsSQL.isEmpty() || deleteAdminsSQL.isEmpty();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment