]> source.dussan.org Git - jgit.git/commitdiff
CommitCommand: Open InputStream in try-with-resource 31/118731/1
authorDavid Pursehouse <david.pursehouse@gmail.com>
Tue, 6 Mar 2018 00:48:19 +0000 (09:48 +0900)
committerDavid Pursehouse <david.pursehouse@gmail.com>
Tue, 6 Mar 2018 00:48:19 +0000 (09:48 +0900)
Change-Id: I800a2afae17f84636cae593be7f07628fb8476c1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java

index 8a89ba16115aefb4512d45a803a0f24981baee2e..f2572835fcd5c7e7bd775f3d4751ecb38dcee928 100644 (file)
@@ -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();
                                                                }
                                                        }
                                                }