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 Chain exceptions Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Chain exceptions" Watch "Chain exceptions" New topic
Author

Chain exceptions

rupika deval
Greenhorn

Joined: Jan 04, 2008
Posts: 6
Can anybody please tell me what exactly do the chained exceptions used for?
Mark Newton
Ranch Hand

Joined: Jan 31, 2006
Posts: 129
Sure - if you tell us what chained exceptions are...

You might want to read: ShowSomeEffort
[ February 05, 2008: Message edited by: David Payne ]
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8264

Any non-trivial application is going to have many layers. Some layers may be concerned with the details of interacting with databases, web services, files and so on. Other layers will contain business logic and still others will render the GUI or offer other services.
When an exception occurs in one layer, it may be necessary to propagate that exception to another layer. Since a business logic layer won't know much about working with files/databases/sockets and we want to isolate that layer from the details, we may throw a custom exception (i.e. CustomerNotFoundException) that the business logic can understand and resolve.
However, we will still want to indicate the original cause of the CustomerNotFoundException for debugging purposes, so we create the custom exception with a reference to the original.
It is not unusual to get a chain of dozens of exceptions in J2EE applications because of all the layers in an application server.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Chain exceptions
 
Similar Threads
Questions from mock Exam !!!
while loop
writing from a jar
my query is successfully running in database but it is returning empty resultset in my java program
executeBatch() not executing