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>
tags/v4.2.0.201511101648-m1
David Pursehouse 8 years ago
parent
commit
581698331a
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      org.eclipse.jgit/src/org/eclipse/jgit/notes/FanoutBucket.java

+ 2
- 2
org.eclipse.jgit/src/org/eclipse/jgit/notes/FanoutBucket.java View File

@@ -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