aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2018-03-06 16:58:12 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2018-03-06 16:58:12 +0900
commitfabd645fad4bb3a0f17075dcace1e16dafa4be14 (patch)
tree151edd8b9507afb0ac31f1d576f4f2555ea17d01
parentae1a53a148527db8371679b805765cb76bbe6304 (diff)
downloadjgit-fabd645fad4bb3a0f17075dcace1e16dafa4be14.tar.gz
jgit-fabd645fad4bb3a0f17075dcace1e16dafa4be14.zip
FS: Open TemporaryBuffer in try-with-resource
Change-Id: I52e048e491e838b7f762a5b5f4d148e91049877c Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java9
1 files changed, 3 insertions, 6 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
index b43a7612de..edcb9d7a6a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
@@ -1227,14 +1227,11 @@ public abstract class FS {
*/
public ExecutionResult execute(ProcessBuilder pb, InputStream in)
throws IOException, InterruptedException {
- TemporaryBuffer stdout = new TemporaryBuffer.LocalFile(null);
- TemporaryBuffer stderr = new TemporaryBuffer.Heap(1024, 1024 * 1024);
- try {
+ try (TemporaryBuffer stdout = new TemporaryBuffer.LocalFile(null);
+ TemporaryBuffer stderr = new TemporaryBuffer.Heap(1024,
+ 1024 * 1024)) {
int rc = runProcess(pb, stdout, stderr, in);
return new ExecutionResult(stdout, stderr, rc);
- } finally {
- stdout.close();
- stderr.close();
}
}