excel-streaming-reader
excel-streaming-reader copied to clipboard
NPE in StreamingWorkbookReader.init(InputStream) exception handler
In StreamingWorkbookReader.init(InputStream), if there's a RuntimeException, f.delete() is called. f may be null at this point, giving a NullPointerException.
try {
f = writeInputStreamToFile(is, builder.getBufferSize());
...
} catch(IOException e) {
throw new ReadException("Unable to read input stream", e);
} catch(RuntimeException e) {
f.delete(); // <----
throw e;
}
This is pretty harmless, but it does hide the original exception. I suppose it just needs an if (f != null) guard.
Good catch, we should definitely add a null guard there.