File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes exception chaining Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "exception chaining" Watch "exception chaining" New topic
Author

exception chaining

jose chiramal
Ranch Hand

Joined: Feb 12, 2010
Posts: 266
Can someone tell me why do we use exception chaining, any practical example for the same ?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

To keep the original exception. throw new Exception(oldException)

Did you try searching for "exception chaining"?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
See if you can find a copy of Thinking in Java by Bruce Eckel; as far as I can remember he gives good examples. His opinion about Exceptions in the 3rd edition is completely different from the 4th edition, however
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3267
    
  52

Please SearchFirst.
The first two Google search results for "Exception Chaining" would give you a better explanation with some practical examples.


Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
Lalit Mehra
Ranch Hand

Joined: Jun 08, 2010
Posts: 384

it is about how an exception is related to another ...

let us say ... you get an exception say SQLException which happened due to some sql related confusion but in actual it is a I/O Exception ...

so the two exceptions are chained together ...

take a look at the complete reference ... although it is not enough but might help you understand some.

Lucky


http://plainoldjavaobject.blogspot.in
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: exception chaining