Methods must not throw RuntimeException
or Exception
. Handling these exceptions requires catching RuntimeException
, which is disallowed by rule ERR14-J. Do not catch NullPointerException, RuntimeException, Exception, or Throwable. Moreover, throwing a RuntimeException
can lead to subtle errors, for example, a caller cannot examine the exception to determine why it was thrown, and consequently cannot attempt recovery.
...
A calling method must violate also rule ERR14-J. Do not catch NullPointerException, RuntimeException, Exception, or Throwable to determine if the RuntimeException
was thrown.
...
ERR11-J. Restore prior object state on method failure 06. Exceptional Behavior (ERR) ERR14-J. Do not catch NullPointerException, RuntimeException, Exception, or Throwable