Author: markt
Date: Mon Aug  7 09:52:52 2017
New Revision: 1804312

URL: http://svn.apache.org/viewvc?rev=1804312&view=rev
Log:
Fix a couple of minor FindBugs warnings

Modified:
    
tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/compressionFilters/CompressionFilter.java

Modified: 
tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/compressionFilters/CompressionFilter.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/compressionFilters/CompressionFilter.java?rev=1804312&r1=1804311&r2=1804312&view=diff
==============================================================================
--- 
tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/compressionFilters/CompressionFilter.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/compressionFilters/CompressionFilter.java
 Mon Aug  7 09:52:52 2017
@@ -42,25 +42,26 @@ import javax.servlet.http.HttpServletRes
 public class CompressionFilter implements Filter {
 
     /**
-     * The filter configuration object we are associated with.  If this value
-     * is null, this filter instance is not currently configured.
+     * Minimal reasonable threshold.
      */
-    private FilterConfig config = null;
+    private static final int MIN_THRESHOLD = 128;
 
     /**
-     * Minimal reasonable threshold.
+     * Minimal reasonable buffer.
      */
-    private int minThreshold = 128;
+    // 8KB is what tomcat would use by default anyway
+    private static final int MIN_BUFFER = 8192;
 
     /**
-     * The threshold number to compress.
+     * The filter configuration object we are associated with.  If this value
+     * is null, this filter instance is not currently configured.
      */
-    protected int compressionThreshold = 0;
+    private FilterConfig config = null;
 
     /**
-     * Minimal reasonable buffer.
+     * The threshold number to compress.
      */
-    private int minBuffer = 8192;  // 8KB is what tomcat would use by default 
anyway
+    protected int compressionThreshold = 0;
 
     /**
      * The compression buffer size to avoid chunking.
@@ -95,24 +96,24 @@ public class CompressionFilter implement
             String str = filterConfig.getInitParameter("compressionThreshold");
             if (str!=null) {
                 compressionThreshold = Integer.parseInt(str);
-                if (compressionThreshold != 0 && compressionThreshold < 
minThreshold) {
+                if (compressionThreshold != 0 && compressionThreshold < 
MIN_THRESHOLD) {
                     if (debug > 0) {
-                        System.out.println("compressionThreshold should be 
either 0 - no compression or >= " + minThreshold);
-                        System.out.println("compressionThreshold set to " + 
minThreshold);
+                        System.out.println("compressionThreshold should be 
either 0 - no compression or >= " + MIN_THRESHOLD);
+                        System.out.println("compressionThreshold set to " + 
MIN_THRESHOLD);
                     }
-                    compressionThreshold = minThreshold;
+                    compressionThreshold = MIN_THRESHOLD;
                 }
             }
 
             str = filterConfig.getInitParameter("compressionBuffer");
             if (str!=null) {
                 compressionBuffer = Integer.parseInt(str);
-                if (compressionBuffer < minBuffer) {
+                if (compressionBuffer < MIN_BUFFER) {
                     if (debug > 0) {
-                        System.out.println("compressionBuffer should be >= " + 
minBuffer);
-                        System.out.println("compressionBuffer set to " + 
minBuffer);
+                        System.out.println("compressionBuffer should be >= " + 
MIN_BUFFER);
+                        System.out.println("compressionBuffer set to " + 
MIN_BUFFER);
                     }
-                    compressionBuffer = minBuffer;
+                    compressionBuffer = MIN_BUFFER;
                 }
             }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to