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 2012/09/02 00:28:30 UTC

svn commit: r1379880 - /myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/renderkit/ServerSideStateCacheImpl.java

Author: lu4242
Date: Sat Sep  1 22:28:30 2012
New Revision: 1379880

URL: http://svn.apache.org/viewvc?rev=1379880&view=rev
Log:
MYFACES-3598 ViewExpiredException during logout after the 3rd login 

Modified:
    myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/renderkit/ServerSideStateCacheImpl.java

Modified: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/renderkit/ServerSideStateCacheImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/renderkit/ServerSideStateCacheImpl.java?rev=1379880&r1=1379879&r2=1379880&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/renderkit/ServerSideStateCacheImpl.java (original)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/renderkit/ServerSideStateCacheImpl.java Sat Sep  1 22:28:30 2012
@@ -620,16 +620,28 @@ class ServerSideStateCacheImpl extends S
                 // into the map.
                 state = null;
             }
-            _serializedViews.put(key, state);
-
+            
             Integer maxCount = getNumberOfSequentialViewsInSession(context);
             if (maxCount != null)
             {
                 if (previousRestoredKey != null)
                 {
-                    _precedence.put((SerializedViewKey) key, previousRestoredKey);
+                    if (!_serializedViews.isEmpty())
+                    {
+                        _precedence.put((SerializedViewKey) key, previousRestoredKey);
+                    }
+                    else
+                    {
+                        // Note when the session is invalidated, _serializedViews map is empty,
+                        // but we could have a not null previousRestoredKey (the last one before
+                        // invalidate the session), so we need to check that condition before
+                        // set the precence. In that way, we ensure the precedence map will always
+                        // have valid keys.
+                        previousRestoredKey = null;
+                    }
                 }
             }
+            _serializedViews.put(key, state);
 
             while (_keys.remove(key))
             {