Browse Source

FanoutBucket: Create ObjectInserter.Formatter in try-with-resource

To prevent potential resource leak.

Change-Id: Ife09be2822bc476199f10da8d1eb7ccc8da05b79
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
stable-4.1
David Pursehouse 9 years ago
parent
commit
581698331a
  1. 4
      org.eclipse.jgit/src/org/eclipse/jgit/notes/FanoutBucket.java

4
org.eclipse.jgit/src/org/eclipse/jgit/notes/FanoutBucket.java

@ -260,8 +260,8 @@ class FanoutBucket extends InMemoryNoteBucket {
}
ObjectId getTreeId() {
try {
return new ObjectInserter.Formatter().idFor(build(false, null));
try (ObjectInserter.Formatter f = new ObjectInserter.Formatter()) {
return f.idFor(build(false, null));
} catch (IOException e) {
// should never happen as we are not inserting
throw new RuntimeException(e);

Loading…
Cancel
Save