Use try-with-resources statements
- instead of finally blocks - in cases of missing try-finally Change-Id: I94f481a33d8e6a3180c436245d6e95e4d525280c
This commit is contained in:
@@ -943,15 +943,10 @@ public class ChangeHookRunner implements ChangeHooks, EventDispatcher,
|
||||
|
||||
ps = pb.start();
|
||||
ps.getOutputStream().close();
|
||||
InputStream is = ps.getInputStream();
|
||||
String output = null;
|
||||
try {
|
||||
try (InputStream is = ps.getInputStream()) {
|
||||
output = readOutput(is);
|
||||
} finally {
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException closeErr) {
|
||||
}
|
||||
ps.waitFor();
|
||||
result = new HookResult(ps.exitValue(), output);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user