Versions Compared

Key

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

...

Even if the programmer now wishes to capture catch and handle the possible checked exceptions, the compiler refuses to believe that any can be thrown in the particular context. One way to deal with this difficulty is to catch Exception and check whether the possible checked exception is an instance of it else re-throw the exception. This is shown below. The most obvious pitfall is that this technique would be is easy to bypass whenever an unanticipated checked exception gets thrown.

...