Use try-with-resource to close resources in CloneCommand

Change-Id: I9536bc208a5f3ec34f0a82fb565b4253be38e074
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Matthias Sohn 2015-04-03 00:38:42 +02:00
parent 81c84c088f
commit 4bae608e84
1 changed files with 1 additions and 4 deletions

View File

@ -322,12 +322,9 @@ private void addMergeConfig(Repository clonedRepo, Ref head)
private RevCommit parseCommit(final Repository clonedRepo, final Ref ref)
throws MissingObjectException, IncorrectObjectTypeException,
IOException {
final RevWalk rw = new RevWalk(clonedRepo);
final RevCommit commit;
try {
try (final RevWalk rw = new RevWalk(clonedRepo)) {
commit = rw.parseCommit(ref.getObjectId());
} finally {
rw.release();
}
return commit;
}