You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2017/12/04 22:59:11 UTC

svn commit: r1817137 - in /tomcat/trunk: java/org/apache/tomcat/util/codec/ java/org/apache/tomcat/util/codec/binary/ webapps/docs/

Author: markt
Date: Mon Dec  4 22:59:11 2017
New Revision: 1817137

URL: http://svn.apache.org/viewvc?rev=1817137&view=rev
Log:
Update the internal fork of Commons Codec to r1817136 to pick up some code clean-up.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/codec/   (props changed)
    tomcat/trunk/java/org/apache/tomcat/util/codec/binary/Base64.java
    tomcat/trunk/java/org/apache/tomcat/util/codec/binary/BaseNCodec.java
    tomcat/trunk/java/org/apache/tomcat/util/codec/binary/StringUtils.java
    tomcat/trunk/webapps/docs/changelog.xml

Propchange: tomcat/trunk/java/org/apache/tomcat/util/codec/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec  4 22:59:11 2017
@@ -1 +1 @@
-/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec:1459201-1757174
+/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec:1459201-1817136

Modified: tomcat/trunk/java/org/apache/tomcat/util/codec/binary/Base64.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/codec/binary/Base64.java?rev=1817137&r1=1817136&r2=1817137&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/codec/binary/Base64.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/codec/binary/Base64.java Mon Dec  4 22:59:11 2017
@@ -550,7 +550,7 @@ public class Base64 extends BaseNCodec {
      * @since 1.4 (NOTE:  1.4 chunked the output, whereas 1.5 does not).
      */
     public static String encodeBase64String(final byte[] binaryData) {
-        return StringUtils.newStringUtf8(encodeBase64(binaryData, false));
+        return StringUtils.newStringUsAscii(encodeBase64(binaryData, false));
     }
 
     /**
@@ -576,7 +576,7 @@ public class Base64 extends BaseNCodec {
      * @since 1.4
      */
     public static String encodeBase64URLSafeString(final byte[] binaryData) {
-        return StringUtils.newStringUtf8(encodeBase64(binaryData, false, true));
+        return StringUtils.newStringUsAscii(encodeBase64(binaryData, false, true));
     }
 
     /**

Modified: tomcat/trunk/java/org/apache/tomcat/util/codec/binary/BaseNCodec.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/codec/binary/BaseNCodec.java?rev=1817137&r1=1817136&r2=1817137&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/codec/binary/BaseNCodec.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/codec/binary/BaseNCodec.java Mon Dec  4 22:59:11 2017
@@ -320,6 +320,8 @@ public abstract class BaseNCodec {
      *
      * @param pArray a byte array containing binary data
      * @return String containing only character data in the appropriate alphabet.
+     * @since 1.5
+     * This is a duplicate of {@link #encodeToString(byte[])}; it was merged during refactoring.
     */
     public String encodeAsString(final byte[] pArray){
         return StringUtils.newStringUtf8(encode(pArray));
@@ -386,7 +388,7 @@ public abstract class BaseNCodec {
      * @return A byte array containing only the base N alphabetic character data
      * @since 1.11
      */
-    public byte[] encode(final byte[] pArray, int offset, int length) {
+    public byte[] encode(final byte[] pArray, final int offset, final int length) {
         if (pArray == null || pArray.length == 0) {
             return pArray;
         }
@@ -425,7 +427,7 @@ public abstract class BaseNCodec {
      *         <code>false</code>, otherwise
      */
     public boolean isInAlphabet(final byte[] arrayOctet, final boolean allowWSPad) {
-        for (byte octet : arrayOctet) {
+        for (final byte octet : arrayOctet) {
             if (!isInAlphabet(octet) &&
                     (!allowWSPad || (octet != pad) && !isWhiteSpace(octet))) {
                 return false;

Modified: tomcat/trunk/java/org/apache/tomcat/util/codec/binary/StringUtils.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/codec/binary/StringUtils.java?rev=1817137&r1=1817136&r2=1817137&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/codec/binary/StringUtils.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/codec/binary/StringUtils.java Mon Dec  4 22:59:11 2017
@@ -21,12 +21,12 @@ import java.nio.charset.StandardCharsets
 
 /**
  * Converts String to and from bytes using the encodings required by the Java specification. These encodings are
- * specified in <a href="http://download.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">
+ * specified in <a href="http://download.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html">
  * Standard charsets</a>.
  *
  * <p>This class is immutable and thread-safe.</p>
  *
- * @see <a href="http://download.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
+ * @see <a href="http://download.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
  * @since 1.4
  */
 public class StringUtils {
@@ -54,7 +54,7 @@ public class StringUtils {
      * @param string
      *            the String to encode, may be <code>null</code>
      * @return encoded bytes, or <code>null</code> if the input string was <code>null</code>
-     * @see <a href="http://download.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
+     * @see <a href="http://download.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
      */
     public static byte[] getBytesUtf8(final String string) {
         return getBytes(string, StandardCharsets.UTF_8);
@@ -75,6 +75,18 @@ public class StringUtils {
     }
 
     /**
+     * Constructs a new <code>String</code> by decoding the specified array of bytes using the US-ASCII charset.
+     *
+     * @param bytes
+     *            The bytes to be decoded into characters
+     * @return A new <code>String</code> decoded from the specified array of bytes using the US-ASCII charset,
+     *         or <code>null</code> if the input byte array was <code>null</code>.
+     */
+    public static String newStringUsAscii(final byte[] bytes) {
+        return newString(bytes, StandardCharsets.US_ASCII);
+    }
+
+    /**
      * Constructs a new <code>String</code> by decoding the specified array of bytes using the UTF-8 charset.
      *
      * @param bytes

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1817137&r1=1817136&r2=1817137&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Mon Dec  4 22:59:11 2017
@@ -90,6 +90,10 @@
         Update the internal fork of Commons FileUpload to 6c00d57 (2017-11-23)
         to pick up some code clean-up. (markt)
       </update>
+      <update>
+        Update the internal fork of Commons Codec to r1817136 to pick up some
+        code clean-up. (markt)
+      </update>
     </changelog>
   </subsection>
 </section>



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