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 10:58:57 GMT
On 15 March 2013 10:37,  <simonetripodi@apache.org> wrote:
> Author: simonetripodi
> Date: Fri Mar 15 10:37:01 2013
> New Revision: 1456871
>
> URL: http://svn.apache.org/r1456871
> Log:
> checkstyle: '256' is a magic number.
>
> Modified:
>     commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/Base64Decoder.java
>
> Modified: commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/Base64Decoder.java
> URL: http://svn.apache.org/viewvc/commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/Base64Decoder.java?rev=1456871&r1=1456870&r2=1456871&view=diff
> ==============================================================================
> --- commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/Base64Decoder.java
(original)
> +++ commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/Base64Decoder.java
Fri Mar 15 10:37:01 2013
> @@ -48,9 +48,14 @@ final class Base64Decoder {
>      private static final byte PADDING = (byte) '=';
>
>      /**
> +     * 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 ...

> +    /**
>       * set up the decoding table.
>       */
> -    private static final byte[] DECODING_TABLE = new byte[256];
> +    private static final byte[] DECODING_TABLE = new byte[DECODING_TABLE_SIZE];

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.


>      static {
>          for (int i = 0; i < ENCODING_TABLE.length; i++) {
>
>

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


Mime
View raw message