...
Note that DivideByZeroException
is a custom exception type that extends Exception
.
Exceptions
EXC14EXC08-EX0: A catch block may catch all exceptions to process them before rethrowing them (filtering sensitive information from exceptions before the call stack leaves a trust boundary, for example). Refer to ERR06-J. Do not allow exceptions to expose sensitive information, as well as CWE 7 and CWE 388. In such cases, a catch block should catch Throwable
rather than Exception
or RuntimeException
.
...
Exception wrapping is a common technique to safely handle unknown exceptions. For another example, see rule ERR10-J. Do not let code throw undeclared checked exceptions.
Wiki Markup |
---|
*EXC14EXC08-EX1*: Task processing threads such as worker threads in a thread pool or the Swing event dispatch thread are permitted to catch {{RuntimeException}} when they call untrusted code through an abstraction such as {{Runnable}} \[[Goetz 2006|AA. Bibliography#Goetz 06], pg. 161\]. |
EXC14EXC08-EX2: Systems that require substantial fault tolerance or graceful degradation are permitted to catch and log general exceptions such as Throwable
at appropriate levels of abstraction. For example:
...
Recommendation | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
ERR14 ERR08-J | medium | likely | medium | P12 | L3 |
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="efbc367c8e371141-e6e56b9e-425e4142-b2d6b4c1-55e9c9f125c56a576de669b6"><ac:plain-text-body><![CDATA[ | [[Cunningham 1995 | AA. Bibliography#Cunningham 95]] |
| ]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="08e8af9893aa38ac-f16a3be6-42da4cfa-991ebfea-713aa279ebece4f928d1620b"><ac:plain-text-body><![CDATA[ | [[Doshi 2003 | AA. Bibliography#Doshi 03]] |
| ]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="b4ea8b4610bbf8b6-ba129d05-4b7147d8-96c9b757-0bb2885954f455ffc16f81f7"><ac:plain-text-body><![CDATA[ | [[Grand 2002 | AA. Bibliography#Grand 02]] | Chapter 8, Behavioral patterns, the Null Object | ]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="0f9c31b3341e819b-f72765e0-424b439d-b743beb4-bfc7323c2352d7ade3637315"><ac:plain-text-body><![CDATA[ | [[Henney 2003 | AA. Bibliography#Henney 03]] |
| ]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="8d63097f4824ac97-734ee049-4e284500-835395f0-31f3f97935deba56bc5e162a"><ac:plain-text-body><![CDATA[ | [[JLS 2005 | AA. Bibliography#JLS 05]] | [Chapter 11, Exceptions | http://java.sun.com/docs/books/jls/third_edition/html/exceptions.html] | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="c2ef39e5630d17d0-f18d758b-4092456e-a36fae8d-cd4bdd45fdb2df7899c0f7f6"><ac:plain-text-body><![CDATA[ | [[J2SE 2011 | AA. Bibliography#J2SE 11]] | Catching Multiple Exception Types and Rethrowing Exceptions with Improved Type Checking | ]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="9351f4dbd9fa299c-e3d8df54-424c4a62-8278bec4-9325fd4b272a33ea3d2dfa85"><ac:plain-text-body><![CDATA[ | [[Muller 2002 | AA. Bibliography#Muller 02]] |
| ]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="8d4c3fb237b3f0c9-8de3a11a-4aeb41ee-902c8d05-a8e494df09f64d76e67c0c1e"><ac:plain-text-body><![CDATA[ | [[Schweisguth 2003 | AA. Bibliography#Schweisguth 03]] |
| ]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="17c82efe5003aa36-5f399e6a-4ea9460c-aeb9822b-f33f1c3dad9e0ef970176cc1"><ac:plain-text-body><![CDATA[ | [[Tutorials 2008 | AA. Bibliography#tutorials 08]] | [Exceptions | http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html] | ]]></ac:plain-text-body></ac:structured-macro> |
...