wood burning stoves*
The moose likes Java in General and the fly likes throw an exception from UncaughtExceptionHandler Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "throw an exception from UncaughtExceptionHandler" Watch "throw an exception from UncaughtExceptionHandler" New topic
Author

throw an exception from UncaughtExceptionHandler

Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Hi All,

I found one nice discussion here .

in my case, I need to throw Checked Exception from uncaughtException . but you cant throw any checked Exception since it is voilating the overriding rule . also uncaughtException not throwing any runtime exception .




any work around ?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39044
    
  23
If the interface doesn't declare an Exception, then you cannot declare any checked Exceptions in implementations. The intention of the method is to handle Exceptions without throwing anything else. The idea is that your implementation ought to be a refinement of the original method. So, every instance where the original method is feasible (ie runs without throwing an Exception) the implementation should be feasible (ie runs without Exceptions). You can fiddle it by throwing a RuntimeException or its subclasses. but that violates the spirit of refinement.

This is too difficult a subject for "beginning" so I shall move this thread.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

thanks Campbell
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39044
    
  23
You're welcome
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: throw an exception from UncaughtExceptionHandler