...
Wiki Markup |
---|
The {{report()}} method accepts a {{Throwable}} instance and consequently handles all errors, checked exceptions, and unchecked exceptions. The filtering mechanism is based on a _whitelisting_ approach wherein only non-sensitive exceptions are propagated to the user. Exceptions that are forbidden to appear in a log file can be filtered in the same fashion (see rule [FIO13-J. Do not log sensitive information outside a trust boundary]. This approach provides the benefits of exception chaining by reporting exceptions tailored to the abstraction while also logging the low-level cause for future failure analysis \[[Bloch 2008|AA. Bibliography#BlochReferences#Bloch 08]\]. |
Noncompliant Code Example
...
Wiki Markup |
---|
This code prevents callers of the {{run()}} method from determining that an interrupted exception occurred. Consequently, the caller methods such as {{Thread.start()}} cannot act on the exception \[[Goetz 2006|AA. Bibliography#GoetzReferences#Goetz 06]\]. Likewise, if this code were called in its own thread, it would prevent the calling thread from knowing that the thread was interrupted. |
...
Wiki Markup |
---|
Consequently, calling methods (or code from a calling thread) can determine that an interrupt was issued \[[Goetz 2006|AA. Bibliography#GoetzReferences#Goetz 06]\]. |
Exceptions
ERR00-EX0: Exceptions that occur during the freeing of a resource may be suppressed in those cases where failure to free the resource cannot affect future program behavior. Examples of freeing resources include closing files, network sockets, shutting down threads, and so forth. Such resources are often freed in catch
or finally
blocks and never reused during subsequent execution. Consequently, the exception cannot influence future program behavior through any avenue other than resource exhaustion. When resource exhaustion is adequately handled, it is sufficient to sanitize and log the exception for future improvement; additional error handling is unnecessary in this case.
...
Wiki Markup |
---|
*ERR00-EX2:* An {{InterruptedException}} may be caught and suppressed when extending class {{Thread}} \[[Goetz 2006|AA. Bibliography#GoetzReferences#Goetz 06]\]. An interruption request may also be suppressed by code that implements a thread's interruption policy \[[Goetz 2006|AA. Bibliography#GoetzReferences#Goetz 06], p. 143\]. |
Risk Assessment
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="62f7af9087101d4f-a1779fc9-49864755-b92a971f-dfe012e02c26ab6e8c294be5"><ac:plain-text-body><![CDATA[ | [[Bloch 2008 | AA. Bibliography#Bloch References#Bloch 08]] | Item 65. Don't ignore exceptions; Item 62. Document all exceptions thrown by each method | ]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="b9466831110e1e9d-1b88a7d1-480b4c69-99288910-f197ef7514aa0364ee712c3b"><ac:plain-text-body><![CDATA[ | [[Goetz 2006 | AA. Bibliography#Goetz References#Goetz 06]] | 5.4, Blocking and interruptible methods | ]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="d910b7b6387ebe79-510a0956-43a4493c-9013a492-75fa6ddaf4056f0c956d9c61"><ac:plain-text-body><![CDATA[ | [[JLS 2005 | AA. Bibliography#JLS References#JLS 05]] | [Chapter 11, Exceptions | http://java.sun.com/docs/books/jls/third_edition/html/exceptions.html] | ]]></ac:plain-text-body></ac:structured-macro> |
...