Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Catching NullPointerException may mask an underlying null dereference, degrade application performance, and result in code that is hard to understand and maintain. Likewise, catching RuntimeException, Exception, or Throwable may unintentionally trap other exception types and prevent them from being handled properly.

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

ERR08-J

Medium

Likely

Medium

P12

L1

Automated Detection

ToolVersionCheckerDescription
CodeSonar
Include Page
CodeSonar_V
CodeSonar_V

JAVA.STRUCT.EXCP.GEH
JAVA.STRUCT.EXCP.INAPP

Generic Exception Handler (Java)
Inappropriate Exception Handler (Java)

Parasoft Jtest
9.5EXCEPT.NCNPEImplemented

...

Include Page
Parasoft_V
Parasoft_V
CERT.ERR08.NCNPEDo not catch 'NullPointerException'
SonarQube
Include Page
SonarQube_V
SonarQube_V

S1181

S1696

Throwable and Error should not be caught

"NullPointerException" should not be caught

SpotBugs

Include Page
SpotBugs_V
SpotBugs_V

DCN_NULLPOINTER_EXCEPTIONImplemented (since 4.5.0)


...