Versions Compared

Key

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

Wiki Markup
According to the Java Language Specification \[[JLS 2005|AA. References#JLS 05]\], sectionSection 11.2, "Compile-Time Checking of Exceptions,"

The unchecked exceptions classes are the class RuntimeException and its subclasses, and the class Error and its subclasses. All other exception classes are checked exception classes.

Unchecked exception classes such as Error and its subclasses are not subject to compile-time checking as because it is tedious to account for all exceptional conditions and recovery is generally difficult. However, most often recovery is not impossibleusually possible, or at least a graceful exit that logs the error is at least feasible.

Noncompliant Code Example

This noncompliant code example generates a StackOverflowError as a result of infinite recursion. This It exhausts the available stack space and may result in denial of service.

...

This compliant solution shows a try-catch block that can be used to capture java.lang.Error or java.lang.Throwable. A log entry can be made at this point and followed by attempts to free key system resources in the finally block.

...

Wiki Markup
\[[JLS 2005|AA. References#JLS 05]\] [Section 11.2, Compile-Time Checking of Exceptions|http://java.sun.com/docs/books/jls/third_edition/html/exceptions.html#11.2]
\[[Kalinovsky 2004|AA. References#Kalinovsky 04]\] Chapter 16, Intercepting Control Flow -: Intercepting System Errors

...