struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hus...@apache.org
Subject svn commit: r520151 - /struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java
Date Mon, 19 Mar 2007 22:48:17 GMT
Author: husted
Date: Mon Mar 19 15:48:16 2007
New Revision: 520151

URL: http://svn.apache.org/viewvc?view=rev&rev=520151
Log:
WW-1803 "ScopeIntercaptor null references on session serialization" apply patch submitted
by Sylvain RIBEYRON.

Modified:
    struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java

Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java?view=diff&rev=520151&r1=520150&r2=520151
==============================================================================
--- struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java
(original)
+++ struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java
Mon Mar 19 15:48:16 2007
@@ -202,25 +202,29 @@
         super();
     }
 
+    // Since 2.0.7. Avoid null references on session serialization (WW-1803).
+    private static class NULLClass implements Serializable {
+      public String toString() {
+        return "NULL";
+      }
+      public boolean equals(Object obj) {
+        return obj == null || (obj instanceof NULLClass);
+      }
+    }
 
-    private static final Object NULL = new Serializable() {
-        public String toString() {
-            return "NULL";
-        }
-    };
+    private static final Object NULL = new NULLClass();
 
     private static final Object nullConvert(Object o) {
         if (o == null) {
             return NULL;
         }
 
-        if (o == NULL) {
+        if (o == NULL || NULL.equals(o)) {
             return null;
         }
 
         return o;
     }
-
 
     private static Map locks = new IdentityHashMap();
 



Mime
View raw message