@Override
public void handle () throws FacesException {
- final Iterator<ExceptionQueuedEvent> i = this.getUnhandledExceptionQueuedEvents().iterator();
+ final Iterator<ExceptionQueuedEvent> iterator = this.getUnhandledExceptionQueuedEvents().iterator();
- while (i.hasNext()) {
- ExceptionQueuedEvent event = i.next();
+ while (iterator.hasNext()) {
+ ExceptionQueuedEvent event = iterator.next();
ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource();
// get the exception from context
Throwable t = context.getException();
- final FacesContext fc = FacesContext.getCurrentInstance();
- final Map<String, Object> requestMap = fc.getExternalContext().getRequestMap();
- final NavigationHandler nav = fc.getApplication().getNavigationHandler();
+ final FacesContext facesContext = FacesContext.getCurrentInstance();
+ final Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap();
+ final NavigationHandler nav = facesContext.getApplication().getNavigationHandler();
//here you do what ever you want with exception
try {
//redirect error page
requestMap.put("exceptionMessage", t.getMessage()); //NOI18N
- nav.handleNavigation(fc, null, "/error"); //NOI18N
- fc.renderResponse();
+ nav.handleNavigation(facesContext, null, "exception"); //NOI18N
+ facesContext.renderResponse();
// remove the comment below if you want to report the error in a jsf error message
// @TODO: JsfUtil.addErrorMessage(t.getMessage());
} finally {
//remove it from queue
- i.remove();
+ iterator.remove();
}
}