Author: tv
Date: Sun Oct 30 21:42:02 2011
New Revision: 1195255

URL: http://svn.apache.org/viewvc?rev=1195255&view=rev
Log:
Fix NPE in CompositeCacheConfigurator.parseRegion. Fixes JCS-79

Modified:
    commons/proper/jcs/trunk/src/changes/changes.xml
    
commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.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=1195255&r1=1195254&r2=1195255&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/changes/changes.xml (original)
+++ commons/proper/jcs/trunk/src/changes/changes.xml Sun Oct 30 21:42:02 2011
@@ -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-79" due-to="Graham Leggett">
+                Fix NPE in CompositeCacheConfigurator.parseRegion
+            </action>
             <action dev="tv" type="fix" issue="JCS-68" due-to="Niall 
Gallagher">
                 Made RemoteCacheServer public, added remote cache remove 
feature to
                 JCSAdminBean

Modified: 
commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java?rev=1195255&r1=1195254&r2=1195255&view=diff
==============================================================================
--- 
commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java
 (original)
+++ 
commons/proper/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java
 Sun Oct 30 21:42:02 2011
@@ -328,54 +328,56 @@ public class CompositeCacheConfigurator
 
         CompositeCache cache = new CompositeCache( regName, cca, ea );
 
-        // Next, create the auxiliaries for the new cache
-        List<AuxiliaryCache> auxList = new ArrayList<AuxiliaryCache>();
-
-        if ( log.isDebugEnabled() )
+        if (value != null)
         {
-            log.debug( "Parsing region name '" + regName + "', value '" + 
value + "'" );
-        }
-
-        // We must skip over ',' but not white space
-        StringTokenizer st = new StringTokenizer( value, "," );
+            // Next, create the auxiliaries for the new cache
+            List<AuxiliaryCache> auxList = new ArrayList<AuxiliaryCache>();
 
-        // If value is not in the form ", appender.." or "", then we should set
-        // the priority of the category.
-
-        if ( !( value.startsWith( "," ) || value.equals( "" ) ) )
-        {
-            // just to be on the safe side...
-            if ( !st.hasMoreTokens() )
+            if ( log.isDebugEnabled() )
             {
-                return null;
+                log.debug( "Parsing region name '" + regName + "', value '" + 
value + "'" );
             }
-        }
 
-        AuxiliaryCache auxCache;
-        String auxName;
-        while ( st.hasMoreTokens() )
-        {
-            auxName = st.nextToken().trim();
-            if ( auxName == null || auxName.equals( "," ) )
+            // We must skip over ',' but not white space
+            StringTokenizer st = new StringTokenizer( value, "," );
+
+            // If value is not in the form ", appender.." or "", then we 
should set
+            // the priority of the category.
+
+            if ( !( value.startsWith( "," ) || value.equals( "" ) ) )
             {
-                continue;
+                // just to be on the safe side...
+                if ( !st.hasMoreTokens() )
+                {
+                    return null;
+                }
             }
-            log.debug( "Parsing auxiliary named \"" + auxName + "\"." );
 
-            auxCache = parseAuxiliary( cache, props, auxName, regName );
-
-            if ( auxCache != null )
+            AuxiliaryCache auxCache;
+            String auxName;
+            while ( st.hasMoreTokens() )
             {
-                auxList.add( auxCache );
+                auxName = st.nextToken().trim();
+                if ( auxName == null || auxName.equals( "," ) )
+                {
+                    continue;
+                }
+                log.debug( "Parsing auxiliary named \"" + auxName + "\"." );
+
+                auxCache = parseAuxiliary( cache, props, auxName, regName );
+
+                if ( auxCache != null )
+                {
+                    auxList.add( auxCache );
+                }
             }
-        }
 
-        // Associate the auxiliaries with the cache
+            // Associate the auxiliaries with the cache
 
-        cache.setAuxCaches( auxList.toArray( new AuxiliaryCache[0] ) );
+            cache.setAuxCaches( auxList.toArray( new AuxiliaryCache[0] ) );
+        }
 
         // Return the new cache
-
         return cache;
     }
 


Reply via email to