Author: sebb
Date: Mon Mar 18 23:45:56 2013
New Revision: 1458064
URL: http://svn.apache.org/r1458064
Log:
Replace 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=1458064&r1=1458063&r2=1458064&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
Mon Mar 18 23:45:56 2013
@@ -48,9 +48,10 @@ final class Base64Decoder {
/**
* Set up the decoding table; this is indexed by a byte converted to an
int,
- * so must be at least as large as the number of different byte values.
+ * so must be at least as large as the number of different byte values,
+ * positive and negative and zero.
*/
- private static final byte[] DECODING_TABLE = new byte[256];
+ private static final byte[] DECODING_TABLE = new byte[Byte.MAX_VALUE -
Byte.MIN_VALUE + 1];
static {
for (int i = 0; i < ENCODING_TABLE.length; i++) {
@@ -129,9 +130,11 @@ final class Base64Decoder {
b4 = DECODING_TABLE[data[i++]];
+ // CHECKSTYLE:OFF
out.write((b1 << 2) | (b2 >> 4));
out.write((b2 << 4) | (b3 >> 2));
out.write((b3 << 6) | b4);
+ // CHECKSTYLE:ON
outLen += 3;
}