commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1395101 - in /commons/proper/net/trunk/src: changes/changes.xml main/java/org/apache/commons/net/util/Base64.java
Date Sat, 06 Oct 2012 15:45:29 GMT
Author: sebb
Date: Sat Oct  6 15:45:29 2012
New Revision: 1395101

URL: http://svn.apache.org/viewvc?rev=1395101&view=rev
Log:
NET-484 Base64.CHUNK_SEPARATOR should be private

Modified:
    commons/proper/net/trunk/src/changes/changes.xml
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/util/Base64.java

Modified: commons/proper/net/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/changes/changes.xml?rev=1395101&r1=1395100&r2=1395101&view=diff
==============================================================================
--- commons/proper/net/trunk/src/changes/changes.xml (original)
+++ commons/proper/net/trunk/src/changes/changes.xml Sat Oct  6 15:45:29 2012
@@ -66,6 +66,9 @@ The <action> type attribute can be add,u
 This release fixes bugs and adds some new functionality (see below).
  It is binary compatible with previous releases
         ">
+            <action issue="NET-484" dev="sebb" type="fix">
+            Base64.CHUNK_SEPARATOR should be private
+            </action>
             <action issue="NET-483" dev="sebb" type="fix">
             Base64.encodeBase64(byte[], boolean, boolean, int) does not calculate output
size correctly for unchunked output.
             </action>

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/util/Base64.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/util/Base64.java?rev=1395101&r1=1395100&r2=1395101&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/util/Base64.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/util/Base64.java Sat Oct
 6 15:45:29 2012
@@ -68,13 +68,11 @@ public class Base64 {
     /**
      * Chunk separator per RFC 2045 section 2.1.
      *
-     * <p>
-     * N.B. The next major release may break compatibility and make this field private.
-     * </p>
-     *
      * @see <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045 section 2.1</a>
      */
-    static final byte[] CHUNK_SEPARATOR = {'\r', '\n'};
+    private static final byte[] CHUNK_SEPARATOR = {'\r', '\n'};
+    
+    private static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
 
     /**
      * This array is a lookup table that translates 6-bit positive integer index values into
their "Base64 Alphabet"
@@ -318,7 +316,7 @@ public class Base64 {
     public Base64(int lineLength, byte[] lineSeparator, boolean urlSafe) {
         if (lineSeparator == null) {
             lineLength = 0;  // disable chunk-separating
-            lineSeparator = CHUNK_SEPARATOR;  // this just gets ignored
+            lineSeparator = EMPTY_BYTE_ARRAY;  // this just gets ignored
         }
         this.lineLength = lineLength > 0 ? (lineLength / 4) * 4 : 0;
         this.lineSeparator = new byte[lineSeparator.length];
@@ -845,7 +843,7 @@ public class Base64 {
             return binaryData;
         }
 
-        long len = getEncodeLength(binaryData, isChunked ? CHUNK_SIZE : 0, CHUNK_SEPARATOR);
+        long len = getEncodeLength(binaryData, isChunked ? CHUNK_SIZE : 0, isChunked ? CHUNK_SEPARATOR
: EMPTY_BYTE_ARRAY);
         if (len > maxResultSize) {
             throw new IllegalArgumentException("Input array too big, the output array would
be bigger (" +
                 len +



Mime
View raw message