Home           J2EE Concepts           JMS           Java Language           Contact           Back           Next           Bookmark this Page          










Some useful tips related to:
 - health & fitness
 - vehicle care
 - cooking
 - misc household tasks

Chained Exceptions!


With Java 2, exception susbsystem has a new feature: Chained Exception. This feature allows you to associate another exception with an exception. The 2nd exception describes cause of first exception.

Following example demonstrates this concept:

try {
// some code (optional)
} catch (ArithmeticException AE) {
throw new DummyException("Another ArithmeticException", AE);
}


Here when an ArithmeticException occurs, a new DummyException exception is created with the original cause and the chain of exceptions is handed over to the parent exception handler.