jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mets...@apache.org
Subject jspwiki git commit: * 2.10.3-git-39
Date Mon, 15 May 2017 16:29:27 GMT
Repository: jspwiki
Updated Branches:
  refs/heads/master be183fc4e -> 340aaea50


       * 2.10.3-git-39

       * JSPWIKI-1059 - ConcurrentModificationException in SessionMonitor


Project: http://git-wip-us.apache.org/repos/asf/jspwiki/repo
Commit: http://git-wip-us.apache.org/repos/asf/jspwiki/commit/340aaea5
Tree: http://git-wip-us.apache.org/repos/asf/jspwiki/tree/340aaea5
Diff: http://git-wip-us.apache.org/repos/asf/jspwiki/diff/340aaea5

Branch: refs/heads/master
Commit: 340aaea503a5643edf4d17d8c0af9fe9453e918a
Parents: be183fc
Author: Harry Metske <harry.metske@gmail.com>
Authored: Mon May 15 18:29:11 2017 +0200
Committer: Harry Metske <harry.metske@gmail.com>
Committed: Mon May 15 18:29:11 2017 +0200

----------------------------------------------------------------------
 ChangeLog                                       |  6 ++++
 .../src/main/java/org/apache/wiki/Release.java  |  2 +-
 .../org/apache/wiki/auth/SessionMonitor.java    | 30 ++++++++++----------
 .../src/main/webapp/WEB-INF/userdatabase.xml    | 21 ++------------
 4 files changed, 24 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jspwiki/blob/340aaea5/ChangeLog
----------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index c2b5fe1..4a7e5c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-05-14  Harry Metske (metskem@apache.org)
+
+       * 2.10.3-git-39
+
+       * JSPWIKI-1059 - ConcurrentModificationException in SessionMonitor
+
 2017-04-22  Dirk Frederickx (brushed AT apache DOT org)
 
        * 2.10.3-git-38  Haddock Template updates

http://git-wip-us.apache.org/repos/asf/jspwiki/blob/340aaea5/jspwiki-war/src/main/java/org/apache/wiki/Release.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/Release.java b/jspwiki-war/src/main/java/org/apache/wiki/Release.java
index d00b688..e23dd87 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/Release.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/Release.java
@@ -72,7 +72,7 @@ public final class Release {
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "38";
+    public static final String     BUILD         = "39";
 
     /**
      *  This is the generic version string you should use when printing out the version.
 It is of

http://git-wip-us.apache.org/repos/asf/jspwiki/blob/340aaea5/jspwiki-war/src/main/java/org/apache/wiki/auth/SessionMonitor.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/auth/SessionMonitor.java b/jspwiki-war/src/main/java/org/apache/wiki/auth/SessionMonitor.java
index c18c3f7..ce2c076 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/auth/SessionMonitor.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/auth/SessionMonitor.java
@@ -22,10 +22,10 @@ import java.security.Principal;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.WeakHashMap;
+import java.util.concurrent.ConcurrentHashMap;
 
 import javax.servlet.http.HttpSession;
 import javax.servlet.http.HttpSessionEvent;
@@ -51,7 +51,7 @@ public class SessionMonitor implements HttpSessionListener
     private static Logger log = Logger.getLogger( SessionMonitor.class );
 
     /** Map with WikiEngines as keys, and SessionMonitors as values. */
-    private static Map<WikiEngine, SessionMonitor>          c_monitors   = new HashMap<WikiEngine,
SessionMonitor>();
+    private static ConcurrentHashMap<WikiEngine, SessionMonitor>          c_monitors
  = new ConcurrentHashMap<WikiEngine, SessionMonitor>();
 
     /** Weak hashmap with HttpSessions as keys, and WikiSessions as values. */
     private final Map<String, WikiSession>                 m_sessions   = new WeakHashMap<String,
WikiSession>();
@@ -74,16 +74,15 @@ public class SessionMonitor implements HttpSessionListener
         }
         SessionMonitor monitor;
 
-        synchronized( c_monitors )
-        {
-            monitor = c_monitors.get(engine);
-            if( monitor == null )
-            {
-                monitor = new SessionMonitor(engine);
+          monitor = c_monitors.get(engine);
+          if( monitor == null )
+          {
+              monitor = new SessionMonitor(engine);
+
+              c_monitors.put( engine, monitor );
+
+          }
 
-                c_monitors.put( engine, monitor );
-            }
-        }
         return monitor;
     }
 
@@ -201,9 +200,10 @@ public class SessionMonitor implements HttpSessionListener
     public final Principal[] userPrincipals()
     {
         Collection<Principal> principals = new ArrayList<Principal>();
-        for ( WikiSession session : m_sessions.values() )
-        {
-            principals.add( session.getUserPrincipal() );
+        synchronized ( m_sessions ) {
+            for (WikiSession session : m_sessions.values()) {
+                principals.add( session.getUserPrincipal() );
+            }
         }
         Principal[] p = principals.toArray( new Principal[principals.size()] );
         Arrays.sort( p, m_comparator );
@@ -257,7 +257,7 @@ public class SessionMonitor implements HttpSessionListener
 
     /**
      * Removes the user's WikiSession from the internal session cache when the web
-     * container destoys an HTTP session.
+     * container destroys an HTTP session.
      * @param se the HTTP session event
      */
     public void sessionDestroyed( HttpSessionEvent se )

http://git-wip-us.apache.org/repos/asf/jspwiki/blob/340aaea5/jspwiki-war/src/main/webapp/WEB-INF/userdatabase.xml
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/webapp/WEB-INF/userdatabase.xml b/jspwiki-war/src/main/webapp/WEB-INF/userdatabase.xml
index b4d76ef..f2742c3 100644
--- a/jspwiki-war/src/main/webapp/WEB-INF/userdatabase.xml
+++ b/jspwiki-war/src/main/webapp/WEB-INF/userdatabase.xml
@@ -1,22 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!--
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.  
--->
-
 <users>
+    <user uid="95ab0d76-13a2-4aa8-bfbe-cd10963c2016" loginName="aap" wikiName="aap" fullName="aap"
email="metskem@www.computerhok.nl" password="{SSHA}OxNFPK8qDGgncWZdxbwWmPPmRKK/OI4Rb60tNQ=="
created="2017.03.05 at 14:01:44:297 CET" lastModified="2017.03.05 at 14:01:44:297 CET" lockExpiry=""
>
+    </user>
 </users>
\ No newline at end of file


Mime
View raw message