Revision: 1400
          http://stripes.svn.sourceforge.net/stripes/?rev=1400&view=rev
Author:   bengunter
Date:     2011-03-03 16:40:54 +0000 (Thu, 03 Mar 2011)

Log Message:
-----------
Fixed STS-812: Problem in flash scope and messages. Messages are copied from 
the previous flash scope into request scope, but if a new message was added 
using the same key then the flashed-in messages were overwritten with a new 
list because only the current flash scope was checked for an existing message 
list. Fixed by checking request scope and attempting to copy existing messages 
to the new list before storing it in the flash and request scopes.

Modified Paths:
--------------
    
branches/1.5.x/stripes/src/net/sourceforge/stripes/action/ActionBeanContext.java

Modified: 
branches/1.5.x/stripes/src/net/sourceforge/stripes/action/ActionBeanContext.java
===================================================================
--- 
branches/1.5.x/stripes/src/net/sourceforge/stripes/action/ActionBeanContext.java
    2011-02-11 20:01:26 UTC (rev 1399)
+++ 
branches/1.5.x/stripes/src/net/sourceforge/stripes/action/ActionBeanContext.java
    2011-03-03 16:40:54 UTC (rev 1400)
@@ -186,6 +186,23 @@
 
         if (messages == null) {
             messages = new ArrayList<Message>();
+
+            /*
+             * Messages imported from previous flash scope will be present in 
request scope but not
+             * in current flash scope. Handle such cases by copying the 
existing messages to a new
+             * list in the current flash and request scopes.
+             */
+            if (getRequest().getAttribute(key) instanceof List) {
+                try {
+                    for (Message message : ((List<Message>) 
getRequest().getAttribute(key))) {
+                        messages.add(message);
+                    }
+                }
+                catch (ClassCastException e) {
+                    messages.clear();
+                }
+            }
+
             scope.put(key, messages);
         }
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to