commit | 3ea04b80025359e4095a5b33f02505325186b793 | [log] [tgz] |
---|---|---|
author | David Pursehouse <dpursehouse@collab.net> | Thu Sep 29 15:32:43 2016 +0900 |
committer | David Pursehouse <dpursehouse@collab.net> | Fri Sep 30 21:46:40 2016 +0900 |
tree | 6dcdd6138bdd433dfb06c339c04869d4b4cfb7bd | |
parent | 040266edb333f603a7b97d55538d65c1c625b2c2 [diff] |
ChangeUpdatedListener: Open database in try-with-resource Change-Id: I7f4ea3eebc5b8d441e7c510ab51a4204476cc878
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewersbyblame/ChangeUpdatedListener.java b/src/main/java/com/googlesource/gerrit/plugins/reviewersbyblame/ChangeUpdatedListener.java index 660ce57..d551acc 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/reviewersbyblame/ChangeUpdatedListener.java +++ b/src/main/java/com/googlesource/gerrit/plugins/reviewersbyblame/ChangeUpdatedListener.java
@@ -113,8 +113,7 @@ try (final Repository git = repoManager.openRepository(projectName)) { try (final RevWalk rw = new RevWalk(git)) { - final ReviewDb reviewDb = schemaFactory.open(); - try { + try (ReviewDb reviewDb = schemaFactory.open()) { Change.Id changeId = new Change.Id(Integer.parseInt(e.change.get().number)); PatchSet.Id psId = new PatchSet.Id(changeId, Integer.parseInt(e.patchSet.get().number)); PatchSet ps = reviewDb.patchSets().get(psId); @@ -183,8 +182,6 @@ } } }); - } finally { - reviewDb.close(); } } } catch (OrmException|IOException x) {