Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The user is allowed to access files in only the user-specific directory so no file system information is leaked in the process. (See guideline EXC06-J. Do not allow exceptions to transmit sensitive information.).

Noncompliant Code Example

...

Wiki Markup
Consequently, code that is higher up on the call stack can see that an interrupt was issued \[[Goetz 2006|AA. Bibliography#Goetz 06]\].

Exceptions

EXC00-EX1: It is reasonable to ignore handling an exception that occurs within a catch or finally block, such as when closing a FileInputStream object.

EXC00-EX2: It is also permissible to ignore handling an exception when it is not possible to recover from the exceptional condition at that abstraction level. In such cases, the exception must be thrown so that higher level code can try recovering from the exceptional condition by catching and handling it.

...

Code Block
bgColor#ccccff
try {
  // Requested file does not exist
  // User is unable to supply the file name
} catch(FileNotFoundException e) { 
  throw new RuntimeException(e);
}

Wiki Markup
*EXC00-EX3:* "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 ignored. A interruption request may also be swallowed by code that implements a thread's interruption policy \[[Goetz 2006, pg 143|AA. Bibliography#Goetz 06]\].

...

Ignoring or suppressing exceptions violates the fail-safe criteria of an application.

Rule Guidline

Severity

Likelihood

Remediation Cost

Priority

Level

EXC00-J

low

probable

medium

P4

L3

...