Use try-with-resources statements
- instead of finally blocks - in cases of missing try-finally Change-Id: I94f481a33d8e6a3180c436245d6e95e4d525280c
This commit is contained in:
@@ -382,8 +382,7 @@ public class ChangeUtil {
|
||||
throw new NoSuchChangeException(patchSetId.getParentKey());
|
||||
}
|
||||
|
||||
Repository repo = gitManager.openRepository(change.getProject());
|
||||
try {
|
||||
try (Repository repo = gitManager.openRepository(change.getProject())) {
|
||||
RefUpdate update = repo.updateRef(patch.getRefName());
|
||||
update.setForceUpdate(true);
|
||||
update.disableRefLog();
|
||||
@@ -399,8 +398,6 @@ public class ChangeUtil {
|
||||
" in " + repo.getDirectory() + ": " + update.getResult());
|
||||
}
|
||||
gitRefUpdated.fire(change.getProject(), update, ReceiveCommand.Type.DELETE);
|
||||
} finally {
|
||||
repo.close();
|
||||
}
|
||||
|
||||
ReviewDb db = this.db.get();
|
||||
|
Reference in New Issue
Block a user