You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2017/05/02 18:14:34 UTC

svn commit: r1793566 - in /felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler: HttpSessionWrapper.java ServletHandler.java

Author: cziegeler
Date: Tue May  2 18:14:34 2017
New Revision: 1793566

URL: http://svn.apache.org/viewvc?rev=1793566&view=rev
Log:
FELIX-5632 : Implement equals and hashCode for HttpSessionWrapper

Modified:
    felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/HttpSessionWrapper.java
    felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/ServletHandler.java

Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/HttpSessionWrapper.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/HttpSessionWrapper.java?rev=1793566&r1=1793565&r2=1793566&view=diff
==============================================================================
--- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/HttpSessionWrapper.java (original)
+++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/HttpSessionWrapper.java Tue May  2 18:14:34 2017
@@ -467,4 +467,25 @@ public class HttpSessionWrapper implemen
             return listener;
         }
     }
+
+    @Override
+    public int hashCode()
+    {
+        return this.getId().hashCode();
+    }
+
+    @Override
+    public boolean equals(final Object obj)
+    {
+        if (this == obj)
+        {
+            return true;
+        }
+        if (obj == null || this.getClass() != obj.getClass() )
+        {
+            return false;
+        }
+        final HttpSessionWrapper other = (HttpSessionWrapper) obj;
+        return other.getId().equals(this.getId());
+    }
 }

Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/ServletHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/ServletHandler.java?rev=1793566&r1=1793565&r2=1793566&view=diff
==============================================================================
--- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/ServletHandler.java (original)
+++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/ServletHandler.java Tue May  2 18:14:34 2017
@@ -60,24 +60,31 @@ public abstract class ServletHandler imp
         this.context = context;
         this.servletInfo = servletInfo;
         final MultipartConfig origConfig = servletInfo.getMultipartConfig();
-        String location = origConfig.multipartLocation;
-        if ( location == null ) {
-            final Object obj = context.getAttribute(JAVA_SERVLET_TEMP_DIR_PROP);
-            if ( obj != null ) {
-                if ( obj instanceof File ) {
-                    location = ((File)obj).getAbsolutePath();
-                } else {
-                    location = obj.toString();
+        if ( origConfig != null )
+        {
+            String location = origConfig.multipartLocation;
+            if ( location == null ) {
+                final Object obj = context == null ? null : context.getAttribute(JAVA_SERVLET_TEMP_DIR_PROP);
+                if ( obj != null ) {
+                    if ( obj instanceof File ) {
+                        location = ((File)obj).getAbsolutePath();
+                    } else {
+                        location = obj.toString();
+                    }
                 }
             }
+            if ( location == null ) {
+                location = TEMP_DIR;
+            }
+            this.mpConfig = new MultipartConfig(origConfig.multipartThreshold,
+                    location,
+                    origConfig.multipartMaxFileSize,
+                    origConfig.multipartMaxRequestSize);
         }
-        if ( location == null ) {
-            location = TEMP_DIR;
+        else
+        {
+            this.mpConfig = null;
         }
-        this.mpConfig = new MultipartConfig(origConfig.multipartThreshold,
-                location,
-                origConfig.multipartMaxFileSize,
-                origConfig.multipartMaxRequestSize);
     }
 
     @Override