aspose file tools*
The moose likes Beginning Java and the fly likes How to handle ExceptionInInitializerError ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to handle ExceptionInInitializerError ?" Watch "How to handle ExceptionInInitializerError ?" New topic
Author

How to handle ExceptionInInitializerError ?

jami siva
Ranch Hand

Joined: Oct 16, 2009
Posts: 63
Hi,

Below is my code, in this iam unable to catch ExceptionInInitializerError, iam only to catch NullPointerException Only,
Can any one make edjustments to this code to handle ExceptionInInitializerError.
Lee Kian Giap
Ranch Hand

Joined: Jan 23, 2008
Posts: 213
I think you can't because ExceptionInInitializerError is a chaining exception.


maybe you can try to use
NullPointerException.getCause() to return a Throwable object and cast it to ExceptionInInitializerError





or a better approach is



SCJP 6, SCWCD 5, SCBCD 5
jami siva
Ranch Hand

Joined: Oct 16, 2009
Posts: 63
HI Lee Kian Giap ,

I Understood this one.

Thank you very much.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to handle ExceptionInInitializerError ?