I'm trying to trace a IO resource leak, where a connection is opened, but not necessarily closed:
try{
...
urlConnection.connect();
...
connectionResult.setResultInputStream(urlConnection.getInputStream());
return connectionResult;
} catch (IOException e) {
throw new ValidationException(e, new LocationData(submissionURL.toExternalForm(), -1, -1));
}
Is there a way I can find out where ValidationException
will be caught through the call hierarchy? The manual steps are something like:
catch Exception
etc)This is certainly not supported by Eclipse "out of the box". Their might be an Eclipse plugin that supports this, but I've not heard of one. (This is something that you rarely need to do in practice ... so there's little justification for going to the effort of implementing this.)
One alternative to code analysis is to hack the code to throw the exception under some circumstance that you can control, and then use the Java debugger to see where it actually gets caught.
Another alternative might be to hack together a custom PMD rule to identify the relevant catches. I don't think it would be simple though ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With