Author: markt
Date: Mon Aug 7 09:50:16 2017
New Revision: 1804310
URL: http://svn.apache.org/viewvc?rev=1804310&view=rev
Log:
Fix a couple of minor FindBugs warnings
Modified:
tomcat/tc8.0.x/trunk/webapps/examples/WEB-INF/classes/compressionFilters/CompressionFilter.java
Modified:
tomcat/tc8.0.x/trunk/webapps/examples/WEB-INF/classes/compressionFilters/CompressionFilter.java
URL:
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/webapps/examples/WEB-INF/classes/compressionFilters/CompressionFilter.java?rev=1804310&r1=1804309&r2=1804310&view=diff
==============================================================================
---
tomcat/tc8.0.x/trunk/webapps/examples/WEB-INF/classes/compressionFilters/CompressionFilter.java
(original)
+++
tomcat/tc8.0.x/trunk/webapps/examples/WEB-INF/classes/compressionFilters/CompressionFilter.java
Mon Aug 7 09:50:16 2017
@@ -50,17 +50,18 @@ public class CompressionFilter implement
/**
* Minimal reasonable threshold.
*/
- private final int minThreshold = 128;
+ private static final int MIN_THRESHOLD = 128;
/**
- * The threshold number to compress.
+ * Minimal reasonable buffer.
*/
- protected int compressionThreshold = 0;
+ // 8KB is what tomcat would use by default anyway
+ private static final int MIN_BUFFER = 8192;
/**
- * Minimal reasonable buffer.
+ * The threshold number to compress.
*/
- private final 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: [email protected]
For additional commands, e-mail: [email protected]