myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r1141390 - /myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/context/AjaxExceptionHandlerImpl.java
Date Thu, 30 Jun 2011 04:25:40 GMT
Author: lu4242
Date: Thu Jun 30 04:25:39 2011
New Revision: 1141390

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

Modified:
    myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/context/AjaxExceptionHandlerImpl.java

Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/context/AjaxExceptionHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/context/AjaxExceptionHandlerImpl.java?rev=1141390&r1=1141389&r2=1141390&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/context/AjaxExceptionHandlerImpl.java
(original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/context/AjaxExceptionHandlerImpl.java
Thu Jun 30 04:25:39 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);
+                            }
                         }
                     }
                 }



Mime
View raw message