You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tv...@apache.org on 2013/08/25 13:03:41 UTC

svn commit: r1517269 - in /commons/proper/jcs/trunk/src: changes/changes.xml java/org/apache/jcs/auxiliary/disk/block/BlockDiskCache.java java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java

Author: tv
Date: Sun Aug 25 11:03:41 2013
New Revision: 1517269

URL: http://svn.apache.org/r1517269
Log:
Fix for JCS-95: Map region names to valid file names.

Modified:
    commons/proper/jcs/trunk/src/changes/changes.xml
    commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCache.java
    commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java

Modified: commons/proper/jcs/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/changes/changes.xml?rev=1517269&r1=1517268&r2=1517269&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/changes/changes.xml (original)
+++ commons/proper/jcs/trunk/src/changes/changes.xml Sun Aug 25 11:03:41 2013
@@ -20,6 +20,9 @@
 	</properties>
 	<body>
 		<release version="2.0" date="unreleased" description="JDK 1.5 based major release">
+            <action dev="tv" type="fix" issue="JCS-95" due-to="Nicolas Gomez Navarrete">
+                Map region names to valid file names.
+            </action>
             <action dev="tv" type="fix" issue="JCS-106" due-to="Johannes Weberhofer">
                 Bad comparison of int with Long.MAX_VALUE.
             </action>

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCache.java?rev=1517269&r1=1517268&r2=1517269&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskCache.java Sun Aug 25 11:03:41 2013
@@ -117,7 +117,8 @@ public class BlockDiskCache<K extends Se
             log.info( logCacheName + "Constructing BlockDiskCache with attributes " + cacheAttributes );
         }
 
-        this.fileName = getCacheName();
+        // Make a clean file name
+        this.fileName = getCacheName().replaceAll("[^a-zA-Z0-9-_\\.]", "_");
         String rootDirName = cacheAttributes.getDiskPath();
         this.rootDirectory = new File( rootDirName );
         this.rootDirectory.mkdirs();

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java?rev=1517269&r1=1517268&r2=1517269&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java Sun Aug 25 11:03:41 2013
@@ -169,7 +169,8 @@ public class IndexedDiskCache<K extends 
         this.isRealTimeOptimizationEnabled = cattr.getOptimizeAtRemoveCount() > 0;
         this.isShutdownOptimizationEnabled = cattr.isOptimizeOnShutdown();
         this.logCacheName = "Region [" + getCacheName() + "] ";
-        this.fileName = getCacheName();
+        // Make a clean file name
+        this.fileName = getCacheName().replaceAll("[^a-zA-Z0-9-_\\.]", "_");
 
         try
         {