commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1457681 - /commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java
Date Mon, 18 Mar 2013 09:25:30 GMT
Author: sebb
Date: Mon Mar 18 09:25:29 2013
New Revision: 1457681

URL: http://svn.apache.org/r1457681
Log:
Document and rename the magic constant

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=1457681&r1=1457680&r2=1457681&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
Mon Mar 18 09:25:29 2013
@@ -33,9 +33,10 @@ final class QuotedPrintableDecoder {
     };
 
     /**
-     * The default number of byte shift for decode.
+     * The shift value required to create the upper nibble 
+     * from the first of 2 byte values converted from ascii hex. 
      */
-    private static final int OUT_SHIFT = 4;
+    private static final int UPPER_NIBBLE_SHIFT = Byte.SIZE / 2;
 
     /**
      * The decoding table size.
@@ -103,7 +104,7 @@ final class QuotedPrintableDecoder {
                     // this is a hex pair we need to convert back to a single byte.
                     byte c1 = DECODING_TABLE[b1];
                     byte c2 = DECODING_TABLE[b2];
-                    out.write((c1 << OUT_SHIFT) | c2);
+                    out.write((c1 << UPPER_NIBBLE_SHIFT) | c2);
                     // 3 bytes in, one byte out
                     bytesWritten++;
                 }



Mime
View raw message