Pārlūkot izejas kodu

Fix EH-CACHE after web context refresh (patch thanks to Travis Gregg).

Ben Alex 21 gadi atpakaļ
vecāks
revīzija
3648073461

+ 1 - 0
changelog.txt

@@ -19,6 +19,7 @@ Changes in version 0.6 (2004-xx-xx)
 * Fixed AbstractProcessingFilter to handle servlet spec container differences
 * Fixed AbstractProcessingFilter to handle servlet spec container differences
 * Fixed AbstractIntegrationFilter to resolve a Weblogic compatibility issue
 * Fixed AbstractIntegrationFilter to resolve a Weblogic compatibility issue
 * Fixed CasAuthenticationToken if proxy granting ticket callback not requested
 * Fixed CasAuthenticationToken if proxy granting ticket callback not requested
+* Fixed EH-CACHE handling on web context refresh
 * Documentation improvements
 * Documentation improvements
 
 
 Changes in version 0.51 (2004-06-06)
 Changes in version 0.51 (2004-06-06)

+ 2 - 0
contributors.txt

@@ -26,6 +26,8 @@ contributions to the Acegi Security System for Spring project:
 
 
 * Scott Evans contributed improvements to the tablig package.
 * Scott Evans contributed improvements to the tablig package.
 
 
+* Travis Gregg contributed a fix to EH-CACHE usage after web context refresh.
+
 * Anyone else I've forgotten (please let me know so I can correct this).
 * Anyone else I've forgotten (please let me know so I can correct this).
 
 
 Plus of course all the people who use the project and provide feedback, bug
 Plus of course all the people who use the project and provide feedback, bug

+ 8 - 7
core/src/main/java/org/acegisecurity/providers/cas/cache/EhCacheBasedTicketCache.java

@@ -95,15 +95,16 @@ public class EhCacheBasedTicketCache implements StatelessTicketCache,
 
 
     public void afterPropertiesSet() throws Exception {
     public void afterPropertiesSet() throws Exception {
         if (CacheManager.getInstance().cacheExists(CACHE_NAME)) {
         if (CacheManager.getInstance().cacheExists(CACHE_NAME)) {
-            CacheManager.getInstance().removeCache(CACHE_NAME);
-        }
+            // don’t remove the cache
+        } else {
+            manager = CacheManager.create();
 
 
-        manager = CacheManager.create();
+            // Cache name, max memory, overflowToDisk, eternal, timeToLive, timeToIdle
+            cache = new Cache(CACHE_NAME, Integer.MAX_VALUE, false, false,
+                    minutesToIdle * 60, minutesToIdle * 60);
 
 
-        // Cache name, max memory, overflowToDisk, eternal, timeToLive, timeToIdle
-        cache = new Cache(CACHE_NAME, Integer.MAX_VALUE, false, false,
-                minutesToIdle * 60, minutesToIdle * 60);
-        manager.addCache(cache);
+            manager.addCache(cache);
+        }
     }
     }
 
 
     public void destroy() throws Exception {
     public void destroy() throws Exception {

+ 8 - 7
core/src/main/java/org/acegisecurity/providers/dao/cache/EhCacheBasedUserCache.java

@@ -96,15 +96,16 @@ public class EhCacheBasedUserCache implements UserCache, InitializingBean,
 
 
     public void afterPropertiesSet() throws Exception {
     public void afterPropertiesSet() throws Exception {
         if (CacheManager.getInstance().cacheExists(CACHE_NAME)) {
         if (CacheManager.getInstance().cacheExists(CACHE_NAME)) {
-            CacheManager.getInstance().removeCache(CACHE_NAME);
-        }
+            // don’t remove the cache
+        } else {
+            manager = CacheManager.create();
 
 
-        manager = CacheManager.create();
+            // Cache name, max memory, overflowToDisk, eternal, timeToLive, timeToIdle
+            cache = new Cache(CACHE_NAME, Integer.MAX_VALUE, false, false,
+                    minutesToIdle * 60, minutesToIdle * 60);
 
 
-        // Cache name, max memory, overflowToDisk, eternal, timeToLive, timeToIdle
-        cache = new Cache(CACHE_NAME, Integer.MAX_VALUE, false, false,
-                minutesToIdle * 60, minutesToIdle * 60);
-        manager.addCache(cache);
+            manager.addCache(cache);
+        }
     }
     }
 
 
     public void destroy() throws Exception {
     public void destroy() throws Exception {