Browse Source

Merge "Use try-with-resource to close resources in CloneCommand"

stable-4.1
Shawn Pearce 10 years ago committed by Gerrit Code Review @ Eclipse.org
parent
commit
b2bba1419f
  1. 5
      org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java

5
org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java

@ -322,12 +322,9 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> {
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;
}

Loading…
Cancel
Save