Can Findbugs detect catching RuntimeException in java? -
could let me know taht findbugs can detect catcing runtimeexception in java?
effective java recommends should not catch runtimeexception.
so want know findbugs can grab wrong catching.
additionally, checked klocwork jd.catch , checkstyle illegalcatch appropriate purpose.
sort of. in findbugs there several bug detectors dealing exceptions:
- de: method might drop exception
- de: method might ignore exception
- nm: class not derived exception, though named such
- rv: exception created , dropped rather thrown
- rec: exception caught when exception not thrown
and 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 out , check if match requirements (especially last 1 (rec) of fb). if plainly need detect following pattern:
catch ( runtimeexception re){ .... }
you may need implement own (quite easy) bug pattern findbugs...
Comments
Post a Comment