Use try-with-resources statements
- instead of finally blocks - in cases of missing try-finally Change-Id: I94f481a33d8e6a3180c436245d6e95e4d525280c
This commit is contained in:
@@ -1031,13 +1031,8 @@ public class MergeOp {
|
||||
@Override
|
||||
public void run() {
|
||||
PatchSet patchSet;
|
||||
try {
|
||||
ReviewDb reviewDb = schemaFactory.open();
|
||||
try {
|
||||
patchSet = reviewDb.patchSets().get(c.currentPatchSetId());
|
||||
} finally {
|
||||
reviewDb.close();
|
||||
}
|
||||
try (ReviewDb reviewDb = schemaFactory.open()) {
|
||||
patchSet = reviewDb.patchSets().get(c.currentPatchSetId());
|
||||
} catch (Exception e) {
|
||||
logError("Cannot send email for submitted patch set " + c.getId(), e);
|
||||
return;
|
||||
@@ -1193,13 +1188,8 @@ public class MergeOp {
|
||||
@Override
|
||||
public void run() {
|
||||
PatchSet patchSet;
|
||||
try {
|
||||
ReviewDb reviewDb = schemaFactory.open();
|
||||
try {
|
||||
patchSet = reviewDb.patchSets().get(c.currentPatchSetId());
|
||||
} finally {
|
||||
reviewDb.close();
|
||||
}
|
||||
try (ReviewDb reviewDb = schemaFactory.open()) {
|
||||
patchSet = reviewDb.patchSets().get(c.currentPatchSetId());
|
||||
} catch (Exception e) {
|
||||
logError("Cannot send email notifications about merge failure", e);
|
||||
return;
|
||||
|
Reference in New Issue
Block a user