You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2013/03/15 11:02:38 UTC
svn commit: r1456852 -
/commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java
Author: simonetripodi
Date: Fri Mar 15 10:02:37 2013
New Revision: 1456852
URL: http://svn.apache.org/r1456852
Log:
checkstyle: '128' is a magic number.
Modified:
commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java
Modified: commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java
URL: http://svn.apache.org/viewvc/commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java?rev=1456852&r1=1456851&r2=1456852&view=diff
==============================================================================
--- commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java (original)
+++ commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java Fri Mar 15 10:02:37 2013
@@ -34,9 +34,14 @@ final class QuotedPrintableDecoder {
};
/**
+ * the decoding table size.
+ */
+ private static final int DECODING_TABLE_SIZE = 128;
+
+ /**
* set up the decoding table.
*/
- private static final byte[] DECODING_TABLE = new byte[128];
+ private static final byte[] DECODING_TABLE = new byte[DECODING_TABLE_SIZE];
static {
// initialize the decoding table
Re: svn commit: r1456852 - /commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java
Posted by sebb <se...@gmail.com>.
On 17 March 2013 11:02, sebb <se...@gmail.com> wrote:
> See other comments on magic number fixes.
>
> I don't think these changes achieve anything apart from keeping
> Checkstyle happy.
> IMO the number is still magic (unexplained) when it is turned into a
> constant, and it seems stilly to have a constant that is only used
> once.
In fact in this case, I think the constant is wrong.
The table is indexed by a byte, which has 256 different values.
Some (bad) input will cause an array bounds exception.
> On 15 March 2013 10:02, <si...@apache.org> wrote:
>> Author: simonetripodi
>> Date: Fri Mar 15 10:02:37 2013
>> New Revision: 1456852
>>
>> URL: http://svn.apache.org/r1456852
>> Log:
>> checkstyle: '128' is a magic number.
>>
>> Modified:
>> commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java
>>
>> Modified: commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java
>> URL: http://svn.apache.org/viewvc/commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java?rev=1456852&r1=1456851&r2=1456852&view=diff
>> ==============================================================================
>> --- commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java (original)
>> +++ commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java Fri Mar 15 10:02:37 2013
>> @@ -34,9 +34,14 @@ final class QuotedPrintableDecoder {
>> };
>>
>> /**
>> + * the decoding table size.
>> + */
>> + private static final int DECODING_TABLE_SIZE = 128;
>> +
>> + /**
>> * set up the decoding table.
>> */
>> - private static final byte[] DECODING_TABLE = new byte[128];
>> + private static final byte[] DECODING_TABLE = new byte[DECODING_TABLE_SIZE];
>>
>> static {
>> // initialize the decoding table
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: svn commit: r1456852 - /commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java
Posted by sebb <se...@gmail.com>.
See other comments on magic number fixes.
I don't think these changes achieve anything apart from keeping
Checkstyle happy.
IMO the number is still magic (unexplained) when it is turned into a
constant, and it seems stilly to have a constant that is only used
once.
On 15 March 2013 10:02, <si...@apache.org> wrote:
> Author: simonetripodi
> Date: Fri Mar 15 10:02:37 2013
> New Revision: 1456852
>
> URL: http://svn.apache.org/r1456852
> Log:
> checkstyle: '128' is a magic number.
>
> Modified:
> commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java
>
> Modified: commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java
> URL: http://svn.apache.org/viewvc/commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java?rev=1456852&r1=1456851&r2=1456852&view=diff
> ==============================================================================
> --- commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java (original)
> +++ commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java Fri Mar 15 10:02:37 2013
> @@ -34,9 +34,14 @@ final class QuotedPrintableDecoder {
> };
>
> /**
> + * the decoding table size.
> + */
> + private static final int DECODING_TABLE_SIZE = 128;
> +
> + /**
> * set up the decoding table.
> */
> - private static final byte[] DECODING_TABLE = new byte[128];
> + private static final byte[] DECODING_TABLE = new byte[DECODING_TABLE_SIZE];
>
> static {
> // initialize the decoding table
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org