Sort of. In findbugs there are several bug detectors dealing with exceptions:
- DE: Method might drop exception
- DE: Method might ignore exception
- Nm: Class is not derived from an Exception, even though it is named as such
- RV: Exception created and dropped rather than thrown
- REC: Exception is caught when Exception is not thrown
and also findbugs-contrib (findbugs plugin) has some:
- BED_BOGUS_EXCEPTION_DECLARATION
- DRE_DECLARED_RUNTIME_EXCEPTION
- EXS_EXCEPTION_SOFTENING_NO_CHECKED
- EXS_EXCEPTION_SOFTENING_HAS_CHECKED
- EXS_EXCEPTION_SOFTENING_NO_CONSTRAINTS
Try those out and check if they match your requirements (especially the last one (REC) of fb). However if you plainly need to detect the following pattern:
catch ( RuntimeException re){
....
}
You may need to implement your own (quite easy) bug pattern for findbugs...