Author: tv
Date: Sat Jul 30 20:27:06 2011
New Revision: 1152513

URL: http://svn.apache.org/viewvc?rev=1152513&view=rev
Log:
- Fixed some dead code warnings
- Fixed VelocityServlet deprecation (now depends on velocity-tools-2.0)

Modified:
    commons/proper/jcs/trunk/pom.xml
    
commons/proper/jcs/trunk/src/java/org/apache/jcs/admin/servlet/JCSAdminServlet.java
    
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCache.java
    
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java
    
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java
    
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java
    
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java
    commons/proper/jcs/trunk/xdocs/changes.xml

Modified: commons/proper/jcs/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/pom.xml?rev=1152513&r1=1152512&r2=1152513&view=diff
==============================================================================
--- commons/proper/jcs/trunk/pom.xml (original)
+++ commons/proper/jcs/trunk/pom.xml Sat Jul 30 20:27:06 2011
@@ -29,8 +29,8 @@
   <artifactId>jcs</artifactId>
   <packaging>jar</packaging>
   <version>1.4-SNAPSHOT</version>
-  <name>Jakarta JCS</name>
-  <url>http://jakarta.apache.org/jcs/</url>
+  <name>Commons JCS</name>
+  <url>http://commons.apache.org/jcs/</url>
   <inceptionYear>2002</inceptionYear>
 
   <dependencies>
@@ -144,9 +144,9 @@
     </dependency>
 
     <dependency>
-      <groupId>velocity</groupId>
-      <artifactId>velocity</artifactId>
-      <version>1.5</version>
+      <groupId>org.apache.velocity</groupId>
+      <artifactId>velocity-tools</artifactId>
+      <version>2.0</version>
       <type>jar</type>
       <scope>compile</scope>
       <optional>true</optional>

Modified: 
commons/proper/jcs/trunk/src/java/org/apache/jcs/admin/servlet/JCSAdminServlet.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/admin/servlet/JCSAdminServlet.java?rev=1152513&r1=1152512&r2=1152513&view=diff
==============================================================================
--- 
commons/proper/jcs/trunk/src/java/org/apache/jcs/admin/servlet/JCSAdminServlet.java
 (original)
+++ 
commons/proper/jcs/trunk/src/java/org/apache/jcs/admin/servlet/JCSAdminServlet.java
 Sat Jul 30 20:27:06 2011
@@ -19,13 +19,15 @@ package org.apache.jcs.admin.servlet;
  * under the License.
  */
 
+import java.io.IOException;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.jcs.admin.JCSAdminBean;
 import org.apache.velocity.Template;
 import org.apache.velocity.context.Context;
-import org.apache.velocity.servlet.VelocityServlet;
+import org.apache.velocity.tools.view.VelocityViewServlet;
 
 /**
  * A servlet which provides HTTP access to JCS. Allows a summary of regions to
@@ -59,7 +61,7 @@ import org.apache.velocity.servlet.Veloc
  * <p>
  */
 public class JCSAdminServlet
-    extends VelocityServlet
+    extends VelocityViewServlet
 {
     private static final long serialVersionUID = -5519844149238645275L;
 
@@ -90,15 +92,14 @@ public class JCSAdminServlet
     /**
      * Velocity based admin servlet.
      * <p>
-     * @param request 
-     * @param response 
-     * @param context 
+     * @param request
+     * @param response
+     * @param context
      * @return Template
-     * @throws Exception 
-     * 
+     * @throws Exception
+     *
      */
     protected Template handleRequest( HttpServletRequest request, 
HttpServletResponse response, Context context )
-        throws Exception
     {
         JCSAdminBean admin = new JCSAdminBean();
 
@@ -112,35 +113,43 @@ public class JCSAdminServlet
 
         String action = request.getParameter( ACTION_PARAM );
 
-        if ( action != null )
+        try
         {
-            if ( action.equals( CLEAR_ALL_REGIONS_ACTION ) )
-            {
-                admin.clearAllRegions();
-            }
-            else if ( action.equals( CLEAR_REGION_ACTION ) )
-            {
-                if ( cacheName != null )
-                {
-                    admin.clearRegion( cacheName );
-                }
-            }
-            else if ( action.equals( REMOVE_ACTION ) )
-            {
-                String[] keys = request.getParameterValues( KEY_PARAM );
-
-                for ( int i = 0; i < keys.length; i++ )
-                {
-                    admin.removeItem( cacheName, keys[i] );
-                }
-
-                templateName = REGION_DETAIL_TEMPLATE_NAME;
-            }
-            else if ( action.equals( DETAIL_ACTION ) )
-            {
-                templateName = REGION_DETAIL_TEMPLATE_NAME;
-            }
-        }
+                       if ( action != null )
+                       {
+                           if ( action.equals( CLEAR_ALL_REGIONS_ACTION ) )
+                           {
+                               admin.clearAllRegions();
+                           }
+                           else if ( action.equals( CLEAR_REGION_ACTION ) )
+                           {
+                               if ( cacheName != null )
+                               {
+                                   admin.clearRegion( cacheName );
+                               }
+                           }
+                           else if ( action.equals( REMOVE_ACTION ) )
+                           {
+                               String[] keys = request.getParameterValues( 
KEY_PARAM );
+
+                               for ( int i = 0; i < keys.length; i++ )
+                               {
+                                   admin.removeItem( cacheName, keys[i] );
+                               }
+
+                               templateName = REGION_DETAIL_TEMPLATE_NAME;
+                           }
+                           else if ( action.equals( DETAIL_ACTION ) )
+                           {
+                               templateName = REGION_DETAIL_TEMPLATE_NAME;
+                           }
+                       }
+               }
+        catch (IOException e)
+        {
+               getLog().error("Could not execute action.", e);
+               return null;
+               }
 
         if ( request.getParameter( SILENT_PARAM ) != null )
         {
@@ -150,15 +159,22 @@ public class JCSAdminServlet
         }
         // Populate the context based on the template
 
-        if ( templateName == REGION_DETAIL_TEMPLATE_NAME )
+        try
         {
-            context.put( "cacheName", cacheName );
-            context.put( "elementInfoRecords", admin.buildElementInfo( 
cacheName ) );
-        }
-        else if ( templateName == DEFAULT_TEMPLATE_NAME )
+                       if ( templateName == REGION_DETAIL_TEMPLATE_NAME )
+                       {
+                           context.put( "cacheName", cacheName );
+                           context.put( "elementInfoRecords", 
admin.buildElementInfo( cacheName ) );
+                       }
+                       else if ( templateName == DEFAULT_TEMPLATE_NAME )
+                       {
+                           context.put( "cacheInfoRecords", 
admin.buildCacheInfo() );
+                       }
+               }
+        catch (Exception e)
         {
-            context.put( "cacheInfoRecords", admin.buildCacheInfo() );
-        }
+               getLog().error("Could not populate context.", e);
+               }
 
         return getTemplate( templateName );
     }

Modified: 
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCache.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCache.java?rev=1152513&r1=1152512&r2=1152513&view=diff
==============================================================================
--- 
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCache.java
 (original)
+++ 
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCache.java
 Sat Jul 30 20:27:06 2011
@@ -697,7 +697,7 @@ public abstract class AbstractDiskCache
                  * The cache is not alive, hence the element should be removed 
from purgatory. All
                  * elements should be removed eventually. Perhaps, the alive 
check should have been
                  * done before it went in the queue. This block handles the 
case where the disk
-                 * cache fails during normal opertations.
+                 * cache fails during normal operations.
                  */
                 synchronized ( purgatory )
                 {

Modified: 
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java?rev=1152513&r1=1152512&r2=1152513&view=diff
==============================================================================
--- 
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java
 (original)
+++ 
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java
 Sat Jul 30 20:27:06 2011
@@ -1057,11 +1057,8 @@ public class JDBCDiskCache
     @Override
     public Set<Serializable> getGroupKeys( String groupName )
     {
-        if ( true )
-        {
-            throw new UnsupportedOperationException( "Groups not implemented." 
);
-        }
-        return null;
+        throw new UnsupportedOperationException( "Groups not implemented." );
+        // return null;
     }
 
     /**

Modified: 
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java?rev=1152513&r1=1152512&r2=1152513&view=diff
==============================================================================
--- 
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java
 (original)
+++ 
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java
 Sat Jul 30 20:27:06 2011
@@ -227,7 +227,6 @@ public class LateralCacheNoWaitFacade
             {
                 log.error( "Failed to get", ex );
             }
-            return null;
         }
         return null;
     }

Modified: 
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java?rev=1152513&r1=1152512&r2=1152513&view=diff
==============================================================================
--- 
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java
 (original)
+++ 
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java
 Sat Jul 30 20:27:06 2011
@@ -368,11 +368,8 @@ public class LateralTCPService
      */
     public Set<Serializable> getGroupKeys( String cacheName, String group )
     {
-        if ( true )
-        {
-            throw new UnsupportedOperationException( "Groups not implemented." 
);
-        }
-        return null;
+        throw new UnsupportedOperationException( "Groups not implemented." );
+        // return null;
     }
 
     /**

Modified: 
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java?rev=1152513&r1=1152512&r2=1152513&view=diff
==============================================================================
--- 
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java
 (original)
+++ 
commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java
 Sat Jul 30 20:27:06 2011
@@ -24,7 +24,6 @@ import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -188,10 +187,9 @@ public abstract class AbstractRemoteCach
             {
                 return noWaits[i].getMatching( pattern );
             }
-            catch ( Exception ex )
+            catch ( IOException ex )
             {
                 log.debug( "Failed to getMatching." );
-                return Collections.emptyMap();
             }
         }
         return Collections.emptyMap();
@@ -214,14 +212,13 @@ public abstract class AbstractRemoteCach
                 {
                     return noWaits[i].getMultiple( keys );
                 }
-                catch ( Exception ex )
+                catch ( IOException ex )
                 {
                     log.debug( "Failed to get." );
-                    return Collections.emptyMap();
                 }
             }
         }
-        return new HashMap<Serializable, ICacheElement>();
+        return Collections.emptyMap();
     }
 
     /**

Modified: commons/proper/jcs/trunk/xdocs/changes.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/xdocs/changes.xml?rev=1152513&r1=1152512&r2=1152513&view=diff
==============================================================================
--- commons/proper/jcs/trunk/xdocs/changes.xml (original)
+++ commons/proper/jcs/trunk/xdocs/changes.xml Sat Jul 30 20:27:06 2011
@@ -20,7 +20,21 @@
        </properties>
        <body>
                <release version="2.0" date="unreleased" description="JDK 1.5 
based major release">
-                       <action dev="bayard" type="add">Upgraded Commons Lang 
dependency to 3.0</action>
+            <action dev="tv" type="fix">
+                Fix VelocityServlet deprecation
+            </action>
+                       <action dev="bayard" type="add">
+                           Upgraded Commons Lang dependency to 3.0
+                       </action>
+            <action dev="tv" type="update">
+                Move to JDK 5 Generics
+            </action>
+            <action dev="tv" type="update">
+                Move to JDK 5 Concurrent
+            </action>
+            <action dev="tv" type="update">
+                Move build system to Maven 2
+            </action>
                </release>
                <release version="1.3.3.5" date="2009-08-12" 
description="tempbuild">
                        <action dev="asmuts" type="fix" issue="JCS-67">Fixed 
bug in


Reply via email to