Versions Compared

Key

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

...

Note that the null check is redundant; if it were removed, the subsequent call to s.equals("") would throw a NullPointerException when s is null. However, the null check explicitly indicates the programmer's intent. More complex code may require explicit testing of invariants and appropriate throw statements.

...

MITRE CWE

CWE-397. Declaration of throws for generic exception

Bibliography

...

      Rule 07: Exceptional Behavior (ERR)Image Added