You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2008/05/04 18:40:09 UTC

svn commit: r653250 - /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/AbstractSessionPersistentFieldStrategy.java

Author: hlship
Date: Sun May  4 09:40:09 2008
New Revision: 653250

URL: http://svn.apache.org/viewvc?rev=653250&view=rev
Log:
TAPESTRY-2308: Don't create HttpSession when persisted property is null

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/AbstractSessionPersistentFieldStrategy.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/AbstractSessionPersistentFieldStrategy.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/AbstractSessionPersistentFieldStrategy.java?rev=653250&r1=653249&r2=653250&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/AbstractSessionPersistentFieldStrategy.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/AbstractSessionPersistentFieldStrategy.java Sun May  4 09:40:09 2008
@@ -117,8 +117,14 @@
         builder.append(':');
         builder.append(fieldName);
 
-        Session session = _request.getSession(true);
+        Session session = _request.getSession(newValue != null);
 
-        session.setAttribute(builder.toString(), newValue);
+        // TAPESTRY-2308: The session will be false when newValue is null and the session
+        // does not already exist.
+
+        if (session != null)
+        {
+            session.setAttribute(builder.toString(), newValue);
+        }
     }
 }