Browse Source

FS: Open TemporaryBuffer in try-with-resource

Change-Id: I52e048e491e838b7f762a5b5f4d148e91049877c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-4.11
David Pursehouse 7 years ago
parent
commit
fabd645fad
  1. 9
      org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java

9
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();
}
}

Loading…
Cancel
Save