]> git.mxchange.org Git - jcore-utils.git/blobdiff - src/org/mxchange/jcoreee/exceptions/CustomExceptionHandler.java
fixed tpzo
[jcore-utils.git] / src / org / mxchange / jcoreee / exceptions / CustomExceptionHandler.java
index 3df048bc3ba25732437a965b9cf1d5c148aea68a..1c33326f3288634a0fbff569e4e0c064e4b2b00f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Roland Haeder
+ * Copyright (C) 2016, 2017 Roland Häder
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@ import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal;
  * <p>
  * 1: https://wmarkito.wordpress.com/2012/04/05/adding-global-exception-handling-using-jsf-2-x-exceptionhandler/
  * <p>
- * @author Roland Haeder<roland@mxchange.org>
+ * @author Roland Häder<roland@mxchange.org>
  */
 public class CustomExceptionHandler extends ExceptionHandlerWrapper {
 
@@ -90,18 +90,18 @@ public class CustomExceptionHandler extends ExceptionHandlerWrapper {
        @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 {
@@ -111,14 +111,14 @@ public class CustomExceptionHandler extends ExceptionHandlerWrapper {
 
                                //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();
                        }
                }