mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-20 06:39:54 +01:00
Replace for with foreach.
I don't care but Android Studio complains.
This commit is contained in:
@@ -514,9 +514,8 @@ abstract class JdbcDatabase implements Database<Connection> {
|
|||||||
int[] batchAffected = ps.executeBatch();
|
int[] batchAffected = ps.executeBatch();
|
||||||
if (batchAffected.length != ids.size())
|
if (batchAffected.length != ids.size())
|
||||||
throw new DbStateException();
|
throw new DbStateException();
|
||||||
for (int i = 0; i < batchAffected.length; i++) {
|
for (int rows : batchAffected)
|
||||||
if (batchAffected[i] != 1) throw new DbStateException();
|
if (rows != 1) throw new DbStateException();
|
||||||
}
|
|
||||||
ps.close();
|
ps.close();
|
||||||
}
|
}
|
||||||
// Make groups that are visible to everyone visible to this contact
|
// Make groups that are visible to everyone visible to this contact
|
||||||
@@ -539,9 +538,8 @@ abstract class JdbcDatabase implements Database<Connection> {
|
|||||||
int[] batchAffected = ps.executeBatch();
|
int[] batchAffected = ps.executeBatch();
|
||||||
if (batchAffected.length != ids.size())
|
if (batchAffected.length != ids.size())
|
||||||
throw new DbStateException();
|
throw new DbStateException();
|
||||||
for (int i = 0; i < batchAffected.length; i++) {
|
for (int rows : batchAffected)
|
||||||
if (batchAffected[i] != 1) throw new DbStateException();
|
if (rows != 1) throw new DbStateException();
|
||||||
}
|
|
||||||
ps.close();
|
ps.close();
|
||||||
}
|
}
|
||||||
// Create a group version row
|
// Create a group version row
|
||||||
@@ -796,9 +794,8 @@ abstract class JdbcDatabase implements Database<Connection> {
|
|||||||
ps.addBatch();
|
ps.addBatch();
|
||||||
int[] batchAffected = ps.executeBatch();
|
int[] batchAffected = ps.executeBatch();
|
||||||
if (batchAffected.length != 3) throw new DbStateException();
|
if (batchAffected.length != 3) throw new DbStateException();
|
||||||
for (int i = 0; i < batchAffected.length; i++) {
|
for (int rows : batchAffected)
|
||||||
if (batchAffected[i] != 1) throw new DbStateException();
|
if (rows != 1) throw new DbStateException();
|
||||||
}
|
|
||||||
ps.close();
|
ps.close();
|
||||||
// Store the outgoing keys
|
// Store the outgoing keys
|
||||||
sql = "INSERT INTO outgoingKeys (contactId, transportId, period,"
|
sql = "INSERT INTO outgoingKeys (contactId, transportId, period,"
|
||||||
@@ -1921,9 +1918,9 @@ abstract class JdbcDatabase implements Database<Connection> {
|
|||||||
int[] batchAffected = ps.executeBatch();
|
int[] batchAffected = ps.executeBatch();
|
||||||
if (batchAffected.length != acked.size())
|
if (batchAffected.length != acked.size())
|
||||||
throw new DbStateException();
|
throw new DbStateException();
|
||||||
for (int i = 0; i < batchAffected.length; i++) {
|
for (int rows : batchAffected) {
|
||||||
if (batchAffected[i] < 0) throw new DbStateException();
|
if (rows < 0) throw new DbStateException();
|
||||||
if (batchAffected[i] > 1) throw new DbStateException();
|
if (rows > 1) throw new DbStateException();
|
||||||
}
|
}
|
||||||
ps.close();
|
ps.close();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
@@ -1947,9 +1944,9 @@ abstract class JdbcDatabase implements Database<Connection> {
|
|||||||
int[] batchAffected = ps.executeBatch();
|
int[] batchAffected = ps.executeBatch();
|
||||||
if (batchAffected.length != requested.size())
|
if (batchAffected.length != requested.size())
|
||||||
throw new DbStateException();
|
throw new DbStateException();
|
||||||
for (int i = 0; i < batchAffected.length; i++) {
|
for (int rows: batchAffected) {
|
||||||
if (batchAffected[i] < 0) throw new DbStateException();
|
if (rows < 0) throw new DbStateException();
|
||||||
if (batchAffected[i] > 1) throw new DbStateException();
|
if (rows > 1) throw new DbStateException();
|
||||||
}
|
}
|
||||||
ps.close();
|
ps.close();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
@@ -1992,9 +1989,9 @@ abstract class JdbcDatabase implements Database<Connection> {
|
|||||||
int[] batchAffected = ps.executeBatch();
|
int[] batchAffected = ps.executeBatch();
|
||||||
if (batchAffected.length != removed.size())
|
if (batchAffected.length != removed.size())
|
||||||
throw new DbStateException();
|
throw new DbStateException();
|
||||||
for (int i = 0; i < batchAffected.length; i++) {
|
for (int rows : batchAffected) {
|
||||||
if (batchAffected[i] < 0) throw new DbStateException();
|
if (rows < 0) throw new DbStateException();
|
||||||
if (batchAffected[i] > 1) throw new DbStateException();
|
if (rows > 1) throw new DbStateException();
|
||||||
}
|
}
|
||||||
ps.close();
|
ps.close();
|
||||||
}
|
}
|
||||||
@@ -2012,9 +2009,9 @@ abstract class JdbcDatabase implements Database<Connection> {
|
|||||||
int[] batchAffected = ps.executeBatch();
|
int[] batchAffected = ps.executeBatch();
|
||||||
if (batchAffected.length != retained.size())
|
if (batchAffected.length != retained.size())
|
||||||
throw new DbStateException();
|
throw new DbStateException();
|
||||||
for (int i = 0; i < batchAffected.length; i++) {
|
for (int rows : batchAffected) {
|
||||||
if (batchAffected[i] < 0) throw new DbStateException();
|
if (rows < 0) throw new DbStateException();
|
||||||
if (batchAffected[i] > 1) throw new DbStateException();
|
if (rows > 1) throw new DbStateException();
|
||||||
}
|
}
|
||||||
// Insert any keys that don't already exist
|
// Insert any keys that don't already exist
|
||||||
sql = "INSERT INTO " + tableName
|
sql = "INSERT INTO " + tableName
|
||||||
@@ -2034,9 +2031,8 @@ abstract class JdbcDatabase implements Database<Connection> {
|
|||||||
}
|
}
|
||||||
batchAffected = ps.executeBatch();
|
batchAffected = ps.executeBatch();
|
||||||
if (batchAffected.length != inserted) throw new DbStateException();
|
if (batchAffected.length != inserted) throw new DbStateException();
|
||||||
for (int i = 0; i < batchAffected.length; i++) {
|
for (int rows : batchAffected)
|
||||||
if (batchAffected[i] != 1) throw new DbStateException();
|
if (rows != 1) throw new DbStateException();
|
||||||
}
|
|
||||||
ps.close();
|
ps.close();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
tryToClose(ps);
|
tryToClose(ps);
|
||||||
@@ -2060,9 +2056,9 @@ abstract class JdbcDatabase implements Database<Connection> {
|
|||||||
}
|
}
|
||||||
int[] batchAffected = ps.executeBatch();
|
int[] batchAffected = ps.executeBatch();
|
||||||
if (batchAffected.length != s.size()) throw new DbStateException();
|
if (batchAffected.length != s.size()) throw new DbStateException();
|
||||||
for (int i = 0; i < batchAffected.length; i++) {
|
for (int rows : batchAffected) {
|
||||||
if (batchAffected[i] < 0) throw new DbStateException();
|
if (rows < 0) throw new DbStateException();
|
||||||
if (batchAffected[i] > 1) throw new DbStateException();
|
if (rows > 1) throw new DbStateException();
|
||||||
}
|
}
|
||||||
// Insert any settings that don't already exist
|
// Insert any settings that don't already exist
|
||||||
sql = "INSERT INTO settings (key, value, namespace)"
|
sql = "INSERT INTO settings (key, value, namespace)"
|
||||||
@@ -2081,9 +2077,8 @@ abstract class JdbcDatabase implements Database<Connection> {
|
|||||||
}
|
}
|
||||||
batchAffected = ps.executeBatch();
|
batchAffected = ps.executeBatch();
|
||||||
if (batchAffected.length != inserted) throw new DbStateException();
|
if (batchAffected.length != inserted) throw new DbStateException();
|
||||||
for (int i = 0; i < batchAffected.length; i++) {
|
for (int rows : batchAffected)
|
||||||
if (batchAffected[i] != 1) throw new DbStateException();
|
if (rows != 1) throw new DbStateException();
|
||||||
}
|
|
||||||
ps.close();
|
ps.close();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
tryToClose(ps);
|
tryToClose(ps);
|
||||||
@@ -2195,9 +2190,8 @@ abstract class JdbcDatabase implements Database<Connection> {
|
|||||||
int[] batchAffected = ps.executeBatch();
|
int[] batchAffected = ps.executeBatch();
|
||||||
if (batchAffected.length != visible.size())
|
if (batchAffected.length != visible.size())
|
||||||
throw new DbStateException();
|
throw new DbStateException();
|
||||||
for (int i = 0; i < batchAffected.length; i++) {
|
for (int rows : batchAffected)
|
||||||
if (batchAffected[i] != 1) throw new DbStateException();
|
if (rows != 1) throw new DbStateException();
|
||||||
}
|
|
||||||
ps.close();
|
ps.close();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
tryToClose(ps);
|
tryToClose(ps);
|
||||||
@@ -2271,9 +2265,8 @@ abstract class JdbcDatabase implements Database<Connection> {
|
|||||||
int[] batchAffected = ps.executeBatch();
|
int[] batchAffected = ps.executeBatch();
|
||||||
if (batchAffected.length != requested.size())
|
if (batchAffected.length != requested.size())
|
||||||
throw new DbStateException();
|
throw new DbStateException();
|
||||||
for (int i = 0; i < batchAffected.length; i++) {
|
for (int rows : batchAffected)
|
||||||
if (batchAffected[i] != 1) throw new DbStateException();
|
if (rows != 1) throw new DbStateException();
|
||||||
}
|
|
||||||
ps.close();
|
ps.close();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
tryToClose(ps);
|
tryToClose(ps);
|
||||||
@@ -2465,9 +2458,8 @@ abstract class JdbcDatabase implements Database<Connection> {
|
|||||||
int[] batchAffected = ps.executeBatch();
|
int[] batchAffected = ps.executeBatch();
|
||||||
if (batchAffected.length != removed.size())
|
if (batchAffected.length != removed.size())
|
||||||
throw new DbStateException();
|
throw new DbStateException();
|
||||||
for (int i = 0; i < batchAffected.length; i++) {
|
for (int rows : batchAffected)
|
||||||
if (batchAffected[i] < 0) throw new DbStateException();
|
if (rows < 0) throw new DbStateException();
|
||||||
}
|
|
||||||
ps.close();
|
ps.close();
|
||||||
}
|
}
|
||||||
// Delete the existing subscriptions, if any
|
// Delete the existing subscriptions, if any
|
||||||
@@ -2491,9 +2483,8 @@ abstract class JdbcDatabase implements Database<Connection> {
|
|||||||
int[] batchAffected = ps.executeBatch();
|
int[] batchAffected = ps.executeBatch();
|
||||||
if (batchAffected.length != groups.size())
|
if (batchAffected.length != groups.size())
|
||||||
throw new DbStateException();
|
throw new DbStateException();
|
||||||
for (int i = 0; i < batchAffected.length; i++) {
|
for (int rows : batchAffected)
|
||||||
if (batchAffected[i] != 1) throw new DbStateException();
|
if (rows != 1) throw new DbStateException();
|
||||||
}
|
|
||||||
ps.close();
|
ps.close();
|
||||||
return true;
|
return true;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user