I get a critical error with findbugs:
The method creates an IO stream object, does not assign it to any fields, pass it to other methods, or return it, and does not appear to close it on all possible exception paths out of the method. This may result in a file descriptor leak. It is generally a good idea to use a finally block to ensure that streams are closed.
try {
...
stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));
...
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
try {
if (stdError != null) {
stdError.close();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
Do I need to close InputStreamReader also or p.getErrorStream (it returns InputStream)?
BufferedReader and InputStreamReader both close the underlying stream when they are closed. You should be fine by closing
stdError