openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1512160 - /openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/MockHttpSession.java
Date Fri, 09 Aug 2013 06:50:28 GMT
Author: rmannibucau
Date: Fri Aug  9 06:50:28 2013
New Revision: 1512160

URL: http://svn.apache.org/r1512160
Log:
weird our MockHttpSession was generating the session id when calling getId() which means we
were getting 2 sessions if we call (what we do) getId() in sart and stop methods

Modified:
    openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/MockHttpSession.java

Modified: openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/MockHttpSession.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/MockHttpSession.java?rev=1512160&r1=1512159&r2=1512160&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/MockHttpSession.java
(original)
+++ openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/MockHttpSession.java
Fri Aug  9 06:50:28 2013
@@ -18,17 +18,23 @@
  */
 package org.apache.webbeans.web.lifecycle.test;
 
-import java.util.Enumeration;
-import java.util.concurrent.atomic.AtomicInteger;
-
 import javax.servlet.ServletContext;
 import javax.servlet.http.HttpSession;
 import javax.servlet.http.HttpSessionContext;
+import java.util.Enumeration;
+import java.util.concurrent.atomic.AtomicInteger;
 
 @SuppressWarnings("unchecked")
 public class MockHttpSession implements HttpSession
 {
-    private static AtomicInteger id = new AtomicInteger(0);
+    private static final AtomicInteger ID = new AtomicInteger(0);
+
+    private final String id;
+
+    public MockHttpSession()
+    {
+        id = Integer.toString(ID.incrementAndGet());
+    }
 
     @Override
     public Object getAttribute(String arg0)
@@ -54,7 +60,7 @@ public class MockHttpSession implements 
     @Override
     public String getId()
     {
-        return Integer.toString(id.getAndIncrement());
+        return id;
     }
 
     @Override



Mime
View raw message