Browse Source

Merge "Fix resource leak in DiffFormatter"

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

5
org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java

@ -173,7 +173,7 @@ public class DiffFormatter implements AutoCloseable {
*/
public void setRepository(Repository repository) {
if (reader != null)
reader.release();
reader.close();
db = repository;
reader = db.newObjectReader();
@ -422,11 +422,12 @@ public class DiffFormatter implements AutoCloseable {
throws IOException {
assertHaveRepository();
RevWalk rw = new RevWalk(reader);
try (RevWalk rw = new RevWalk(reader)) {
RevTree aTree = a != null ? rw.parseTree(a) : null;
RevTree bTree = b != null ? rw.parseTree(b) : null;
return scan(aTree, bTree);
}
}
/**
* Determine the differences between two trees.

Loading…
Cancel
Save