Use try-with-resource to close resources in CherryPickCommand
Change-Id: I62d6de7d67c7de2460f4cbe918ad2bb8109650b9 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
81c84c088f
commit
58c2c52219
|
@ -123,8 +123,7 @@ public CherryPickResult call() throws GitAPIException, NoMessageException,
|
|||
List<Ref> cherryPickedRefs = new LinkedList<Ref>();
|
||||
checkCallable();
|
||||
|
||||
RevWalk revWalk = new RevWalk(repo);
|
||||
try {
|
||||
try (RevWalk revWalk = new RevWalk(repo)) {
|
||||
|
||||
// get the head commit
|
||||
Ref headRef = repo.getRef(Constants.HEAD);
|
||||
|
@ -194,8 +193,6 @@ public CherryPickResult call() throws GitAPIException, NoMessageException,
|
|||
MessageFormat.format(
|
||||
JGitText.get().exceptionCaughtDuringExecutionOfCherryPickCommand,
|
||||
e), e);
|
||||
} finally {
|
||||
revWalk.release();
|
||||
}
|
||||
return new CherryPickResult(newHead, cherryPickedRefs);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue