This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JSF and the fly likes JSF 2.0 exception handling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSF
Bookmark "JSF 2.0 exception handling" Watch "JSF 2.0 exception handling" New topic
Author

JSF 2.0 exception handling

N Ha
Greenhorn

Joined: Jun 02, 2010
Posts: 9
Hello,

I want to throw a custom exception "AppException" in my controller, where this AppException extends Exception. And to catch it in my CustomExceptionHandler.
The problem is that when I go to the CustomExceptionHandler, I get the exception as "FacesException" not "AppException "

<factory>
<exception-handler-factory>com.web.common.exceptions.DefaultExceptionHandlerFactory</exception-handler-factory>
</factory>

public class DefaultExceptionHandlerFactory extends ExceptionHandlerFactory {
public ExceptionHandler getExceptionHandler() {
ExceptionHandler eh = new DefaultExceptionHandler(parent.getExceptionHandler());
return eh;
}
}

public class DefaultExceptionHandler extends ExceptionHandlerWrapper {
public void handle() throws FacesException {
Iterator i = getUnhandledExceptionQueuedEvents().iterator();
while (i.hasNext()) {
ExceptionQueuedEvent event = (ExceptionQueuedEvent) i.next();
ExceptionQueuedEventContext context =
(ExceptionQueuedEventContext)event.getSource();

//obtain throwable object
Throwable t = context.getException();
............
}
}
}

Any help?
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: JSF 2.0 exception handling
 
It's not a secret anymore!