commit | 23416c105d805d81eb1f9256c54294b43f105322 | [log] [tgz] |
---|---|---|
author | David Pursehouse <dpursehouse@collab.net> | Mon May 29 10:36:02 2017 +0900 |
committer | David Pursehouse <dpursehouse@collab.net> | Mon May 29 10:36:02 2017 +0900 |
tree | bd9562369b3e5f86a6bd7d8b68fc76cd8c608d70 | |
parent | 2bd0a03b8949d6a4d100939ab67b9eccd0a3355e [diff] |
SetPreferences: Open MetaDataUpdate in try-with-resource Change-Id: I2ca5fd003068cf3506dc0b0b33f1eb8dca165c26
diff --git a/src/main/java/com/googlesource/gerrit/plugins/labelui/SetPreferences.java b/src/main/java/com/googlesource/gerrit/plugins/labelui/SetPreferences.java index ca53199..ddc76d8 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/labelui/SetPreferences.java +++ b/src/main/java/com/googlesource/gerrit/plugins/labelui/SetPreferences.java
@@ -77,8 +77,7 @@ VersionedAccountPreferences p = VersionedAccountPreferences.forUser(rsrc.getUser().getAccountId()); - MetaDataUpdate md = metaDataUpdateFactory.get().create(allUsersName); - try { + try (MetaDataUpdate md = metaDataUpdateFactory.get().create(allUsersName)) { p.load(md); if (input.ui != LabelUi.DEFAULT) { @@ -88,8 +87,6 @@ } p.commit(md); - } finally { - md.close(); } PreferencesInfo info = new PreferencesInfo();