The merits of exception handling are challenged when programmers do not realize how exceptions should be treated. Imprecise handling can lead to loss of critical information, on the other hand, being too specific can result in verbose (unreadable) code.
...
Noncompliant Code Example
In this non-compliant noncompliant code example, a divide by zero exception was handled initially. Instead of the specific exception type ArithmeticException
, a more generic type Exception
was caught. This is dangerous since any future exception updates to the method signature (such as, addition of IOException
here) may no longer require the developer to provide a handler. Consequently, the recovery process may not be tailored to the specific exception type that gets thrown.
...
Rule | Severity | Likelihood | Remediation Cost | Priority | Level | |
---|---|---|---|---|---|---|
EXC00-J | medium | probable | high | P?? | P4 | L3 L?? |
Automated Detection
TODO
Related Vulnerabilities
...
Wiki Markup |
---|
\[[Doshi 03|AA. Java References#Doshi 03]\] \[[JLS 05|AA. Java References#JLS 05]\] CHAPTER 11, Exceptions \[[Tutorials 08|AA. Java References#tutorials 08]\] [Exceptions|http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html] \[[MüllerMüller 02|AA. Java References#MüllerReferences#Müller 02]\] |