On 17 March 2013 11:02, sebb <seb...@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, <simonetrip...@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-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org