Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Reproduce:
ClassParser cp = new ClassParser("does/not/exist/Classfile.class");
JavaClass jc = cp.parse();
--> throws NullPointerException instead of FileNotFoundException
The problem is that when the constructor that accepts a string is used, the
fileOwned flag is set and parse() attempts to close the file in the finally
block. The guarded region for the finally block includes the attempt to open the
input stream, which may fail, but the finally block itself erroneously assumes
the input stream object has been created.
Previously this situation caused the method to correctly throw a
FileNotFoundException.