Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
Operating System: other
Platform: All
Description
This bug affects revision 1.13 of JavaClass.java.
The org.apache.bcel.classfile.JavaClass.getAllInterfaces() method calls
JavaClass.getInterfaces(), which uses a Repository to look up the class's interfaces. If any of the interfaces are not found, then getInterfaces() returns null. However, getAllInterfaces() tries to dereference this null reference, leading to the exception.
A simple fix would be to return a zero-length array from getInterfaces() in the case where a repository lookup fails.
A better fix would be to have getInterfaces() throw the ClassNotFoundException out of the method. In general, I think repository lookup failures should be propagated as much as possible, so the program using BCEL can detect them. Right now there is a println() to System.err in getInterfaces(), which is not a very useful way to report the failure.