You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2014/08/06 21:44:52 UTC

svn commit: r1616326 - /myfaces/core/branches/2.1.x/shared/src/main/java/org/apache/myfaces/shared/context/SwitchAjaxExceptionHandlerWrapperImpl.java

Author: lu4242
Date: Wed Aug  6 19:44:51 2014
New Revision: 1616326

URL: http://svn.apache.org/r1616326
Log:
MYFACES-3913 NPE in SwitchAjaxExceptionHandlerWrapperImpl (Thanks to Thomas Andraschko for provide this patch)

Modified:
    myfaces/core/branches/2.1.x/shared/src/main/java/org/apache/myfaces/shared/context/SwitchAjaxExceptionHandlerWrapperImpl.java

Modified: myfaces/core/branches/2.1.x/shared/src/main/java/org/apache/myfaces/shared/context/SwitchAjaxExceptionHandlerWrapperImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x/shared/src/main/java/org/apache/myfaces/shared/context/SwitchAjaxExceptionHandlerWrapperImpl.java?rev=1616326&r1=1616325&r2=1616326&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x/shared/src/main/java/org/apache/myfaces/shared/context/SwitchAjaxExceptionHandlerWrapperImpl.java (original)
+++ myfaces/core/branches/2.1.x/shared/src/main/java/org/apache/myfaces/shared/context/SwitchAjaxExceptionHandlerWrapperImpl.java Wed Aug  6 19:44:51 2014
@@ -21,6 +21,7 @@ package org.apache.myfaces.shared.contex
 import javax.faces.context.ExceptionHandler;
 import javax.faces.context.ExceptionHandlerWrapper;
 import javax.faces.context.FacesContext;
+import javax.faces.context.PartialViewContext;
 import javax.faces.event.AbortProcessingException;
 import javax.faces.event.ExceptionQueuedEvent;
 import javax.faces.event.ExceptionQueuedEventContext;
@@ -31,9 +32,6 @@ import javax.faces.event.SystemEvent;
  * normal exceptionHandler wrapping, because FacesContext is initialized after
  * ExceptionHandler, so it is not safe to get it when
  * ExceptionHandlerFactory.getExceptionHandler() is called.
- * 
- * @author Leonardo Uribe
- *
  */
 public class SwitchAjaxExceptionHandlerWrapperImpl extends ExceptionHandlerWrapper
 {
@@ -85,7 +83,12 @@ public class SwitchAjaxExceptionHandlerW
         if (_isAjaxRequest == null)
         {
             facesContext = (facesContext == null) ? FacesContext.getCurrentInstance() : facesContext;
-            _isAjaxRequest = facesContext.getPartialViewContext().isAjaxRequest();
+            PartialViewContext pvc = facesContext.getPartialViewContext();
+            if (pvc == null)
+            {
+                return false;
+            }
+            _isAjaxRequest = pvc.isAjaxRequest();
         }
         return _isAjaxRequest;
     }
@@ -95,7 +98,12 @@ public class SwitchAjaxExceptionHandlerW
         if (_isAjaxRequest == null)
         {
             FacesContext facesContext = FacesContext.getCurrentInstance();
-            _isAjaxRequest = facesContext.getPartialViewContext().isAjaxRequest();
+            PartialViewContext pvc = facesContext.getPartialViewContext();
+            if (pvc == null)
+            {
+                return false;
+            }
+            _isAjaxRequest = pvc.isAjaxRequest();
         }
         return _isAjaxRequest;
     }