Menu

#31 No Exception Documentation for Enhancer.create() Methods

open
nobody
None
5
2010-02-13
2010-02-13
D
No

There's a lack of exception documentation on the Enhancer.create() methods (and may exist elsewhere in the API documentation, too). Or rather what happens if the enhancer can't create the subclass (and/or implementation) or if it can't instantiate the dynamic subclass. In the standard Java lib, Constructor.newInstance() specifies four different exceptions it can throw: IllegalArgumentException, InstantiationException, IllegalAccessException, and InvocationTargetException. Given the nature of the Enhancer.create(), It seems that at minimum these four exceptions could arise, but the method does not throw any of these. I can only conclude that thowables that are subclasses of RuntimeException are handled internally and an instance RuntimeException (or a subclass thereof) is thrown on failure, instead. (The alternative would be for the method to silently fail and return a null.) Unfortunately, this provides very little help in determining how to handle the exception, determining whether or not my application or lib can recover, and how it can recover.

Discussion

MongoDB Logo MongoDB