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 2011/06/30 06:26:28 UTC

svn commit: r1141391 - /myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/AjaxExceptionHandlerImpl.java

Author: lu4242
Date: Thu Jun 30 04:26:28 2011
New Revision: 1141391

URL: http://svn.apache.org/viewvc?rev=1141391&view=rev
Log:
MYFACES-3053 Improve error reporting and logging (Fix Ajax Case)

Modified:
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/AjaxExceptionHandlerImpl.java

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/AjaxExceptionHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/AjaxExceptionHandlerImpl.java?rev=1141391&r1=1141390&r2=1141391&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/AjaxExceptionHandlerImpl.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/AjaxExceptionHandlerImpl.java Thu Jun 30 04:26:28 2011
@@ -207,6 +207,7 @@ public class AjaxExceptionHandlerImpl ex
             if (!throwableList.isEmpty())
             {
                 PartialResponseWriter partialWriter = null;
+                boolean responseComplete = false;
 
                 //Retrieve the partial writer used to render the exception
                 if (facesContext == null)
@@ -239,6 +240,8 @@ public class AjaxExceptionHandlerImpl ex
                     {
                         renderAjaxError(partialWriter, t);
                     }
+                    
+                    responseComplete = true;
                 }
                 catch (IOException e)
                 {
@@ -249,15 +252,19 @@ public class AjaxExceptionHandlerImpl ex
                 }
                 finally
                 {
-                    try
+                    if (responseComplete)
                     {
-                        partialWriter.endDocument();
-                    }
-                    catch (IOException e1)
-                    {
-                        if (log.isLoggable(Level.SEVERE))
+                        try
+                        {
+                            partialWriter.endDocument();
+                            facesContext.responseComplete();
+                        }
+                        catch (IOException e1)
                         {
-                            log.log(Level.SEVERE, "Cannot render exception on ajax request", e1);
+                            if (log.isLoggable(Level.SEVERE))
+                            {
+                                log.log(Level.SEVERE, "Cannot render exception on ajax request", e1);
+                            }
                         }
                     }
                 }