commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1458062 - in /commons/proper/fileupload/trunk/src: checkstyle/checkstyle-suppressions.xml checkstyle/fileupload_checks.xml main/java/org/apache/commons/fileupload/FileUploadBase.java
Date Mon, 18 Mar 2013 23:35:56 GMT
Author: sebb
Date: Mon Mar 18 23:35:56 2013
New Revision: 1458062

URL: http://svn.apache.org/r1458062
Log:
Better way to suppress individual checkstyle issues

Modified:
    commons/proper/fileupload/trunk/src/checkstyle/checkstyle-suppressions.xml
    commons/proper/fileupload/trunk/src/checkstyle/fileupload_checks.xml
    commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/FileUploadBase.java

Modified: commons/proper/fileupload/trunk/src/checkstyle/checkstyle-suppressions.xml
URL: http://svn.apache.org/viewvc/commons/proper/fileupload/trunk/src/checkstyle/checkstyle-suppressions.xml?rev=1458062&r1=1458061&r2=1458062&view=diff
==============================================================================
--- commons/proper/fileupload/trunk/src/checkstyle/checkstyle-suppressions.xml (original)
+++ commons/proper/fileupload/trunk/src/checkstyle/checkstyle-suppressions.xml Mon Mar 18
23:35:56 2013
@@ -20,7 +20,5 @@
 -->
 <suppressions>
   <suppress checks="MagicNumber" files="Base64Decoder.java" lines="0-9999"/>
-  <!-- This inline conditional is easier to read than the alternative -->
-  <suppress checks="AvoidInlineConditionals" files="FileUploadBase.java" lines="950-960"/>
   <suppress checks="[a-zA-Z0-9]*" files=".+\.properties" />
 </suppressions>

Modified: commons/proper/fileupload/trunk/src/checkstyle/fileupload_checks.xml
URL: http://svn.apache.org/viewvc/commons/proper/fileupload/trunk/src/checkstyle/fileupload_checks.xml?rev=1458062&r1=1458061&r2=1458062&view=diff
==============================================================================
--- commons/proper/fileupload/trunk/src/checkstyle/fileupload_checks.xml (original)
+++ commons/proper/fileupload/trunk/src/checkstyle/fileupload_checks.xml Mon Mar 18 23:35:56
2013
@@ -90,10 +90,16 @@
     <!-- Require package Javadoc -->
     <module name="JavadocPackage"/>
 
+    <!-- Allow comments to suppress checks -->
+    <module name="SuppressionCommentFilter"/>
+
     <module name="TreeWalker">
 
         <property name="cacheFile" value="${checkstyle.cache.file}"/>
 
+        <!-- Allow comments to suppress checks -->
+        <module name="FileContentsHolder"/>
+
         <!-- Checks for Javadoc comments.                     -->
         <!-- See http://checkstyle.sf.net/config_javadoc.html -->
         <module name="JavadocMethod">

Modified: commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/FileUploadBase.java
URL: http://svn.apache.org/viewvc/commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/FileUploadBase.java?rev=1458062&r1=1458061&r2=1458062&view=diff
==============================================================================
--- commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/FileUploadBase.java
(original)
+++ commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/FileUploadBase.java
Mon Mar 18 23:35:56 2013
@@ -953,9 +953,12 @@ public abstract class FileUploadBase {
 
             @SuppressWarnings("deprecation") // still has to be backward compatible
             final int contentLengthInt = ctx.getContentLength();
+
             final long requestSize = UploadContext.class.isAssignableFrom(ctx.getClass())
+                                     // Inline conditional is OK here CHECKSTYLE:OFF
                                      ? ((UploadContext) ctx).contentLength()
                                      : contentLengthInt;
+                                     // CHECKSTYLE:ON
 
             if (sizeMax >= 0) {
                 if (requestSize != -1 && requestSize > sizeMax) {



Mime
View raw message