Browse Source

CommitCommand: Open InputStream in try-with-resource

Change-Id: I800a2afae17f84636cae593be7f07628fb8476c1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-4.11
David Pursehouse 7 years ago
parent
commit
3393f78210
  1. 7
      org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java

7
org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java

@ -409,14 +409,11 @@ public class CommitCommand extends GitCommand<RevCommit> {
inserter = repo.newObjectInserter();
long contentLength = fTree
.getEntryContentLength();
InputStream inputStream = fTree
.openEntryStream();
try {
try (InputStream inputStream = fTree
.openEntryStream()) {
dcEntry.setObjectId(inserter.insert(
Constants.OBJ_BLOB, contentLength,
inputStream));
} finally {
inputStream.close();
}
}
}

Loading…
Cancel
Save