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/08/08 20:16:25 UTC
svn commit: r1155035 -
/myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/UIViewRoot.java
Author: lu4242
Date: Mon Aug 8 18:16:25 2011
New Revision: 1155035
URL: http://svn.apache.org/viewvc?rev=1155035&view=rev
Log:
MYFACES-3199 Handling AbortProcessingException is unconsistent (Problem 3 clarification JSF spec 2.1 "...throwing an AbortProcessingException tells an implementation that no further broadcast of the
current event occurs. Does not affect future events. ..."
Modified:
myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/UIViewRoot.java
Modified: myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/UIViewRoot.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/UIViewRoot.java?rev=1155035&r1=1155034&r2=1155035&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/UIViewRoot.java (original)
+++ myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/UIViewRoot.java Mon Aug 8 18:16:25 2011
@@ -25,6 +25,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -265,20 +266,23 @@ public class UIViewRoot extends UICompon
int loops = 0;
int maxLoops = 15;
- boolean continueProcessing = true;
+ Collection<FacesEvent> eventsAborted = new LinkedList<FacesEvent>();
do
{
// First broadcast events that have been queued for PhaseId.ANY_PHASE.
- continueProcessing = _broadcastAll(context, events.getAnyPhase());
- if (continueProcessing)
+ _broadcastAll(context, events.getAnyPhase(), eventsAborted);
+ Collection<FacesEvent> eventsOnPhase = events.getOnPhase();
+ if (!eventsAborted.isEmpty())
{
- continueProcessing = _broadcastAll(context, events.getOnPhase());
+ eventsOnPhase.removeAll(eventsAborted);
+ eventsAborted.clear();
}
+ _broadcastAll(context, eventsOnPhase, eventsAborted);
events = _getEvents(phaseId);
loops++;
- } while (events.hasMoreEvents() && loops < maxLoops && continueProcessing);
+ } while (events.hasMoreEvents() && loops < maxLoops);
if (loops == maxLoops && events.hasMoreEvents()) {
// broadcast reach maxLoops - probably a infinitive recursion:
@@ -957,7 +961,7 @@ public class UIViewRoot extends UICompon
*
* @return <code>true</code> if the broadcast was completed without abortion, <code>false</code> otherwise
*/
- private boolean _broadcastAll(FacesContext context, Collection<? extends FacesEvent> events)
+ private void _broadcastAll(FacesContext context, Collection<? extends FacesEvent> events, Collection<FacesEvent> eventsAborted)
{
assert events != null;
@@ -985,7 +989,7 @@ public class UIViewRoot extends UICompon
context.getApplication().publishEvent(context, ExceptionQueuedEvent.class, exceptionContext);
// Abortion
- return false;
+ eventsAborted.add(event);
}
finally
{
@@ -998,7 +1002,6 @@ public class UIViewRoot extends UICompon
}
}
- return true;
}
private void clearEvents()