...
Wiki Markup |
---|
Consequently, code that is higher up on the call stack (or code from a calling thread) can see that an interrupt was issued \[[Goetz 2006|AA. Bibliography#Goetz 06]\]. |
Exceptions
EXC00ERR00-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, etc. Such resources are generally freed in catch or finally blocks, and are 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.
EXC00ERR00-EX1: When recovery from an exceptional condition is impossible at a particular abstraction level, code at that level should avoid handling that exceptional condition. In such cases, an appropriate exception must be thrown so that higher level code can catch the exceptional condition and can attempt recovery. The most common implementation for this case is to omit a catch
block and consequently allow the exception to propagate normally, as shown below.
...
Code Block | ||
---|---|---|
| ||
try { // Requested file does not exist // User is unable to supply the file name } catch (FileNotFoundException e) { throw new IOException(e); } |
Wiki Markup |
---|
*EXC00ERR00-EX2:* "The only situation in which it is acceptable to swallow an interrupt is when you are extending Thread and therefore control all the code higher up on the call stack" \[[Goetz 2006|AA. Bibliography#Goetz 06]\]. In such cases {{InterruptedException}} may be caught and suppressed. A interruption request may also be suppressed by code that implements a thread's interruption policy \[[Goetz 2006, pg 143|AA. Bibliography#Goetz 06]\]. |
...
Guideline | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
EXC00 ERR00-J | low | probable | medium | P4 | L3 |
Automated Detection
...