diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/LocalUsernamesToLowerCase.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/LocalUsernamesToLowerCase.java index c3cf91489c..5b6179cc4f 100644 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/LocalUsernamesToLowerCase.java +++ b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/LocalUsernamesToLowerCase.java @@ -116,14 +116,7 @@ public class LocalUsernamesToLowerCase extends SiteProgram { private class Worker extends Thread { @Override public void run() { - final ReviewDb db; - try { - db = database.open(); - } catch (OrmException e) { - e.printStackTrace(); - return; - } - try { + try (ReviewDb db = database.open()){ for (;;) { final AccountExternalId extId = next(); if (extId == null) { @@ -134,8 +127,8 @@ public class LocalUsernamesToLowerCase extends SiteProgram { monitor.update(1); } } - } finally { - db.close(); + } catch (OrmException e) { + e.printStackTrace(); } } } diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/CherryPick.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/CherryPick.java index 08117d1a1c..ad5940e041 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/change/CherryPick.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/CherryPick.java @@ -66,6 +66,7 @@ public class CherryPick implements RestModifyView, return change.getDest().get(); } + @SuppressWarnings("resource") ReviewDb db = dbProvider.get(); PatchSet basePatchSet = parseBase(base); if (basePatchSet == null) { diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/Submit.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/Submit.java index 2d7db67f7e..c6048bb6de 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/change/Submit.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/Submit.java @@ -217,6 +217,7 @@ public class Submit implements RestModifyView, private String problemsForSubmittingChangeset( ChangeSet cs, IdentifiedUser identifiedUser) { try { + @SuppressWarnings("resource") ReviewDb db = dbProvider.get(); for (PatchSet.Id psId : cs.patchIds()) { ChangeControl changeControl = changeControlFactory diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/config/RequestScopedReviewDbProvider.java b/gerrit-server/src/main/java/com/google/gerrit/server/config/RequestScopedReviewDbProvider.java index 4ada7b122b..c2c002e7ef 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/config/RequestScopedReviewDbProvider.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/config/RequestScopedReviewDbProvider.java @@ -37,6 +37,7 @@ public class RequestScopedReviewDbProvider implements Provider { this.cleanup = cleanup; } + @SuppressWarnings("resource") @Override public ReviewDb get() { if (db == null) { diff --git a/plugins/replication b/plugins/replication index 679301a1b4..264b7a0036 160000 --- a/plugins/replication +++ b/plugins/replication @@ -1 +1 @@ -Subproject commit 679301a1b49245c78ca1bce0b62c9fa9e6b32eea +Subproject commit 264b7a00361f8a880cbad389523bf329f1989480 diff --git a/plugins/reviewnotes b/plugins/reviewnotes index d81e2d6d3e..b19086265e 160000 --- a/plugins/reviewnotes +++ b/plugins/reviewnotes @@ -1 +1 @@ -Subproject commit d81e2d6d3edc27c7aceea47518cbb03fb5590f11 +Subproject commit b19086265e7cb3c23b9fbf7193fbbd16eadc3bf0 diff --git a/plugins/singleusergroup b/plugins/singleusergroup index 082bf62238..6fb010107a 160000 --- a/plugins/singleusergroup +++ b/plugins/singleusergroup @@ -1 +1 @@ -Subproject commit 082bf62238d4d815636a329cc1ef4d86b36f982e +Subproject commit 6fb010107a7dfdd6baff2b54e65fb74c933d6654