aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2018-03-06 09:48:19 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2018-03-06 09:48:19 +0900
commit3393f78210862b3ccd954f029d831ef783b35c89 (patch)
tree9a4f844bfc835fcf215903bbeeb57814df3e31ab /org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java
parent18263417934cc6d080916aea7bf56c8206a2b0c9 (diff)
downloadjgit-3393f78210862b3ccd954f029d831ef783b35c89.tar.gz
jgit-3393f78210862b3ccd954f029d831ef783b35c89.zip
CommitCommand: Open InputStream in try-with-resource
Change-Id: I800a2afae17f84636cae593be7f07628fb8476c1 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java7
1 files changed, 2 insertions, 5 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java
index 8a89ba1611..f2572835fc 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java
+++ b/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();
}
}
}