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);
+        }
     }
 }


Reply via email to