Few, if any, methods are capable of handling all possible runtime exceptions. Consequently, methods are forbidden to catch RuntimeException
. When a method catches RuntimeException
, it may receive exceptions unanticipated by the designer, such as NullPointerException
. Many catch
clauses simply log or ignore the enclosed exceptional condition, and attempt to resume normal execution; this practice often violates guideline EXC00-J. Do not suppress or ignore checked exceptions. Runtime exceptions often indicate bugs in the program that should be fixed by the developer, and often cause control flow vulnerabilities. Methods are also forbidden from catching to catch Exception
or Throwable
, because this implies catching RuntimeException
; RuntimeException
extends Exception
which in turn extends Throwable
.
...