commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r1456871 - /commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/Base64Decoder.java
Date Sun, 17 Mar 2013 13:32:06 GMT
On 17 March 2013 13:18, Simone Tripodi <simonetripodi@apache.org> wrote:
>>>      /**
>>> +     * the decoding table size.
>>> +     */
>>> +    private static final int DECODING_TABLE_SIZE = 256;
>>> +
>>
>> The Javadoc does not say why the value 256 is used, so the number is
>> still a magic number ...
>>
>
> What should be added more than `the decoding table size` in javadoc?

Why is it 256 and not 127 or 13 or 512 or some other arbitrary number?
Are there any restrictions on what it could be?

About the only numbers that are not always magic are 0, 1 and -1.
Other numbers need to be explained.

> I'd rather continue investing time on a private static field of a
> package-private class...
>
>>
>> In this case, I'm not sure that using a constant add any benefit as
>> the value was only used once.
>> I think Checkstyle is being too strict here; I suggest leaving this
>> change, but I don't see a need to fix everything the Checkstyle does
>> not like.
>>
>
> Agreed - I had two options:
>
>  1) suppress the rule;
>
>  2) just make checkstyle happy.
>
> Even if I was really tempted by #1, at the end I went to #2 to be
> conform to more popular way of coding - I sure someone would have
> fixed it, sooner or later...

Unfortunately the fix means that the problem - that the number is
magic - is no longer reported, so the whole point of the Checkstyle
rule has been lost.

> http://people.apache.org/~simonetripodi/
> http://simonetripodi.livejournal.com/
> http://twitter.com/simonetripodi
> http://www.99soft.org/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message