You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2007/08/09 17:52:58 UTC

svn commit: r564250 - in /myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago: application/ActionListenerImpl.java component/UIViewRoot.java

Author: weber
Date: Thu Aug  9 08:52:57 2007
New Revision: 564250

URL: http://svn.apache.org/viewvc?view=rev&rev=564250
Log:
(TOBAGO-463) ActionListenerImpl should not catch AbortProcessingException

Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/application/ActionListenerImpl.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIViewRoot.java

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/application/ActionListenerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/application/ActionListenerImpl.java?view=diff&rev=564250&r1=564249&r2=564250
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/application/ActionListenerImpl.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/application/ActionListenerImpl.java Thu Aug  9 08:52:57 2007
@@ -35,6 +35,7 @@
 import javax.faces.event.AbortProcessingException;
 import javax.faces.event.ActionEvent;
 import javax.faces.event.ActionListener;
+import javax.faces.FacesException;
 
 public class ActionListenerImpl implements ActionListener {
 
@@ -52,6 +53,15 @@
     try {
       base.processAction(event);
     } catch (Throwable e) {
+      if (e instanceof FacesException) {
+        Throwable fe = e;
+        while (fe != null) {
+          if (fe instanceof AbortProcessingException) {
+            throw (FacesException)e;
+          }
+          fe = fe.getCause();
+        }
+      }
       LOG.error("Processing failed. Forwarding to error page. errorOutcome="
           + errorOutcome, e.getCause());
       FacesContext facesContext = FacesContext.getCurrentInstance();

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIViewRoot.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIViewRoot.java?view=diff&rev=564250&r1=564249&r2=564250
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIViewRoot.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIViewRoot.java Thu Aug  9 08:52:57 2007
@@ -19,12 +19,15 @@
 
 import org.apache.myfaces.tobago.context.ClientProperties;
 import org.apache.myfaces.tobago.context.ResourceManagerImpl;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.event.AbortProcessingException;
 import javax.faces.event.FacesEvent;
 import javax.faces.event.PhaseId;
+import javax.faces.FacesException;
 import java.util.ArrayList;
 import java.util.ConcurrentModificationException;
 import java.util.List;
@@ -38,6 +41,8 @@
  */
 public class UIViewRoot extends javax.faces.component.UIViewRoot {
 
+  private static final Log LOG = LogFactory.getLog(UIViewRoot.class);
+
   private ResourceManagerImpl.CacheKey rendererCacheKey;
 
   private ClientProperties clientProperties;
@@ -126,12 +131,26 @@
         UIComponent source = event.getComponent();
         try {
           source.broadcast(event);
-        } catch (AbortProcessingException e) {
-          // abort event processing
-          // Page 3-30 of JSF 1.1 spec: "Throw an AbortProcessingException, to tell the JSF implementation
-          //  that no further broadcast of this event, or any further events, should take place."
-          abort = true;
-          break;
+        } catch (FacesException e) {
+          Throwable fe = e;
+          while (fe != null) {
+            if (fe instanceof AbortProcessingException) {
+              if (LOG.isTraceEnabled()) {
+                LOG.trace("AbortProcessingException catched!");
+              }
+              // abort event processing
+              // Page 3-30 of JSF 1.1 spec: "Throw an AbortProcessingException, to tell the JSF implementation
+              //  that no further broadcast of this event, or any further events, should take place."
+              abort = true;
+              break;
+            }
+            fe = fe.getCause();
+          }
+          if (!abort) {
+            throw e;
+          } else {
+            break;
+          }
         } finally {
 
           try {