| Author |
exception-type
|
shanthisri mocherla
Ranch Hand
Joined: Sep 05, 2005
Posts: 119
|
|
Hi friends, I'm not clear with line in HFSJ page 595.(there are no dumb questions) Question: what are you allowed to declare as an exception type in <exception-type>??Answer: Anything that's throwable so that includes java.lang.Error,runtime exceptions, and any checked exception(as long as the checked exception class is on the Container's classpath,of course) Can anyone please expand this and expalin me clearly. Thank you very much shanthi
|
 |
Narendra Dhande
Ranch Hand
Joined: Dec 04, 2004
Posts: 950
|
|
Hi,
Question: what are you allowed to declare as an exception type in <exception-type>??Answer: Anything that's throwable so that includes java.lang.Error,runtime exceptions, and any checked exception(as long as the checked exception class is on the Container's classpath,of course)
The <exception-type> requires the full class name of the Throwable type, which we want to catch by this mechanism. As the type is "Throwable" we can catch Errors, Run-time Exceptions and Checked Exception. Checked Exceptions are ususlly declare in the method defination throws clause, if you want to propogate the exceptions to the outer world (i.e to Exception handling mechanism).
any checked exception(as long as the checked exception class is on the Container's classpath
If it is required to define custom exceptions for exception handling the user usullay define the checked exceptions. So these checked exception clsses must be accessible to container , so it should be in the container's classpath. If the containe can not find Exception class it will be error. Hope it help Thanks
|
Narendra Dhande
SCJP 1.4,SCWCD 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA 5.0
|
 |
 |
|
|
subject: exception-type
|
|
|