org.apache.commons.lang

Class UnhandledException

Implemented Interfaces:
Nestable, Serializable

public class UnhandledException
extends NestableRuntimeException

Thrown when it is impossible or undesirable to consume or throw a checked exception. This exception supplements the standard exception classes by providing a more semantically rich description of the problem.

UnhandledException represents the case where a method has to deal with a checked exception but does not wish to. Instead, the checked exception is rethrown in this unchecked wrapper.

 public void foo() {
   try {
     // do something that throws IOException
   } catch (IOException ex) {
     // don't want to or can't throw IOException from foo()
     throw new UnhandledException(ex);
   }
 }
 
Since:
2.0
See Also:
Serialized Form

Field Summary

Fields inherited from class org.apache.commons.lang.exception.NestableRuntimeException

delegate

Constructor Summary

UnhandledException(String message, Throwable cause)
Constructs the exception using a message and cause.
UnhandledException(Throwable cause)
Constructs the exception using a cause.

Method Summary

Methods inherited from class org.apache.commons.lang.exception.NestableRuntimeException

getCause, getMessage, getMessage, getMessages, getThrowable, getThrowableCount, getThrowables, indexOfThrowable, indexOfThrowable, printPartialStackTrace, printStackTrace, printStackTrace, printStackTrace

Methods inherited from class java.lang.Throwable

fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

UnhandledException

public UnhandledException(String message,
                          Throwable cause)
Constructs the exception using a message and cause.
Parameters:
message - the message to use
cause - the underlying cause

UnhandledException

public UnhandledException(Throwable cause)
Constructs the exception using a cause.
Parameters:
cause - the underlying cause
Usages and Demos :

View More Examples of UnhandledException(Throwable cause)
   1:         } catch (IOException e) {
   2:             throw new UnhandledException(e);
   3:         }
   4:         ...
   5:         } catch (IOException e) {
   6:             throw new UnhandledException(e);
   7:         }
   8:     }

View Full Code Here
   1:         } catch (KeyManagementException e) {
   2:             throw new UnhandledException(e);
   3:         } catch (NoSuchAlgorithmException e) {
   4:         ...
   5:             throw new UnhandledException(e);
   6:         }
   7:     }
   8: }

View Full Code Here
   1:         } catch (KeyManagementException e) {
   2:             throw new UnhandledException(e);
   3:         } catch (NoSuchAlgorithmException e) {
   4:         ...
   5:             throw new UnhandledException(e);
   6:         }
   7:     }
   8: }

View Full Code Here
   1:         } catch (IOException ex) {
   2:             throw new UnhandledException(ex); 
   3:         }
   4:     }

View Full Code Here
   1:         {
   2:             throw new UnhandledException(e);
   3:         }
   4:         twin.properties = (Properties) this.properties.clone();
   5:         return twin;

View Full Code Here