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 2015/04/03 23:03:59 UTC

svn commit: r1671161 - /myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java

Author: lu4242
Date: Fri Apr  3 21:03:58 2015
New Revision: 1671161

URL: http://svn.apache.org/r1671161
Log:
MYFACES-3975 PreClearFlashEvent called on every JSF request regardless of Flash use

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

Modified: myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java?rev=1671161&r1=1671160&r2=1671161&view=diff
==============================================================================
--- myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java (original)
+++ myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java Fri Apr  3 21:03:58 2015
@@ -1063,18 +1063,21 @@ public class FlashImpl extends Flash imp
     {
         Map<String, Object> map = _getExecuteFlashMap(facesContext);
 
-        //JSF 2.2 invoke PreClearFlashEvent
-        facesContext.getApplication().publishEvent(facesContext, 
-            PreClearFlashEvent.class, map);
-        
-        // Clear everything - note that because of naming conventions,
-        // this will in fact automatically recurse through all children
-        // grandchildren etc. - which is kind of a design flaw of SubKeyMap,
-        // but one we're relying on
-        
-        // NOTE that we do not need a null check here, because there will
-        // always be an execute Map, however sometimes an empty one!
-        map.clear();
+        if (!map.isEmpty())
+        {
+            //JSF 2.2 invoke PreClearFlashEvent
+            facesContext.getApplication().publishEvent(facesContext, 
+                PreClearFlashEvent.class, map);
+
+            // Clear everything - note that because of naming conventions,
+            // this will in fact automatically recurse through all children
+            // grandchildren etc. - which is kind of a design flaw of SubKeyMap,
+            // but one we're relying on
+
+            // NOTE that we do not need a null check here, because there will
+            // always be an execute Map, however sometimes an empty one!
+            map.clear();
+        }
     }
     
     private void _clearRenderFlashTokenIfMapEmpty(FacesContext facesContext)