Methods must not throw RuntimeException
or Exception
. Handling these exceptions requires catching RuntimeException
, which is disallowed by rule ERR14-J. Do not catch RuntimeException. Moreover, throwing a RuntimeException
can lead to subtle errors, for instanceexample, a caller cannot examine the exception to determine why it was thrown, and consequently cannot attempt recovery.
...
Code Block | ||
---|---|---|
| ||
private void doSomething() throws IOException { //... } |
...
Exceptions
EXC13-EX0: Classes that sanitize exceptions to comply with a security policy are permitted to translate specific exceptions into more general exceptions. This translation could potentially result in throwing RuntimeException
or Exception
in some cases, depending on the details of the security policy.
...