Release any ObjectReaders created by JGit

RevWalk implicitly creates an ObjectReader if you call its Repository
based constructor.  Ensure we always release those ObjectReaders,
or use our own that we can release when we are done.

Change-Id: I6421507d248e331e7c35bdeb7831ea2f7bcff6b5
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2010-08-23 11:58:42 -07:00
parent 6001b80cc7
commit 122ea72ba2
10 changed files with 224 additions and 176 deletions

View File

@@ -140,8 +140,12 @@ public class ScanTrackingIds extends SiteProgram {
private RevCommit parse(final Repository git, PatchSet ps)
throws MissingObjectException, IncorrectObjectTypeException, IOException {
return new RevWalk(git).parseCommit(ObjectId.fromString(ps.getRevision()
.get()));
RevWalk rw = new RevWalk(git);
try {
return rw.parseCommit(ObjectId.fromString(ps.getRevision().get()));
} finally {
rw.release();
}
}
private Change next() {