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 2022/11/29 14:52:35 UTC

[tomcat] branch 9.0.x updated: Update Commons Codec. No functional change.

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new a1b411cd5e Update Commons Codec. No functional change.
a1b411cd5e is described below

commit a1b411cd5e27b1595689a54bacc577f53412dcf2
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Nov 29 14:49:34 2022 +0000

    Update Commons Codec. No functional change.
---
 MERGE.txt                                                |  2 +-
 java/org/apache/tomcat/util/codec/binary/Base64.java     | 16 ++++++++--------
 java/org/apache/tomcat/util/codec/binary/BaseNCodec.java | 16 ++++++----------
 .../org/apache/tomcat/util/codec/binary/StringUtils.java |  5 +----
 webapps/docs/changelog.xml                               |  8 ++++++--
 5 files changed, 22 insertions(+), 25 deletions(-)

diff --git a/MERGE.txt b/MERGE.txt
index ba6fdf3c89..65f94662ff 100644
--- a/MERGE.txt
+++ b/MERGE.txt
@@ -43,7 +43,7 @@ Codec
 Sub-tree:
 src/main/java/org/apache/commons/codec
 The SHA1 ID / tag for the most recent commit to be merged to Tomcat is:
-fd44e6b491c9d606d0b91ac0029269d265024cd9 (2021-09-01)
+ae32a3f2fa6b722b8ad67bd125a52edb78932314 (2022-11-29)
 Note: Only classes required for Base64 encoding/decoding. The rest are removed.
 
 FileUpload
diff --git a/java/org/apache/tomcat/util/codec/binary/Base64.java b/java/org/apache/tomcat/util/codec/binary/Base64.java
index 3cd4f1a558..d383e9b3cc 100644
--- a/java/org/apache/tomcat/util/codec/binary/Base64.java
+++ b/java/org/apache/tomcat/util/codec/binary/Base64.java
@@ -508,7 +508,7 @@ public class Base64 extends BaseNCodec {
      * </p>
      *
      * @param lineLength
-     *            Each line of encoded data will be at most of the given length (rounded down to nearest multiple of
+     *            Each line of encoded data will be at most of the given length (rounded down to the nearest multiple of
      *            4). If lineLength &lt;= 0, then the output will not be divided into lines (chunks). Ignored when
      *            decoding.
      * @since 1.4
@@ -531,7 +531,7 @@ public class Base64 extends BaseNCodec {
      * </p>
      *
      * @param lineLength
-     *            Each line of encoded data will be at most of the given length (rounded down to nearest multiple of
+     *            Each line of encoded data will be at most of the given length (rounded down to the nearest multiple of
      *            4). If lineLength &lt;= 0, then the output will not be divided into lines (chunks). Ignored when
      *            decoding.
      * @param lineSeparator
@@ -558,7 +558,7 @@ public class Base64 extends BaseNCodec {
      * </p>
      *
      * @param lineLength
-     *            Each line of encoded data will be at most of the given length (rounded down to nearest multiple of
+     *            Each line of encoded data will be at most of the given length (rounded down to the nearest multiple of
      *            4). If lineLength &lt;= 0, then the output will not be divided into lines (chunks). Ignored when
      *            decoding.
      * @param lineSeparator
@@ -617,8 +617,8 @@ public class Base64 extends BaseNCodec {
      * https://svn.apache.org/repos/asf/webservices/commons/trunk/modules/util/
      * </p>
      *
-     * @param in
-     *            byte[] array of ascii data to base64 decode.
+     * @param input
+     *            byte[] array of ASCII data to base64 decode.
      * @param inPos
      *            Position to start reading data from.
      * @param inAvail
@@ -627,7 +627,7 @@ public class Base64 extends BaseNCodec {
      *            the context to be used
      */
     @Override
-    void decode(final byte[] in, int inPos, final int inAvail, final Context context) {
+    void decode(final byte[] input, int inPos, final int inAvail, final Context context) {
         if (context.eof) {
             return;
         }
@@ -636,7 +636,7 @@ public class Base64 extends BaseNCodec {
         }
         for (int i = 0; i < inAvail; i++) {
             final byte[] buffer = ensureBufferSize(decodeSize, context);
-            final byte b = in[inPos++];
+            final byte b = input[inPos++];
             if (b == pad) {
                 // We're done.
                 context.eof = true;
@@ -784,7 +784,7 @@ public class Base64 extends BaseNCodec {
      *
      * @param octet
      *            The value to test
-     * @return {@code true} if the value is defined in the the Base64 alphabet {@code false} otherwise.
+     * @return {@code true} if the value is defined in the Base64 alphabet {@code false} otherwise.
      */
     @Override
     protected boolean isInAlphabet(final byte octet) {
diff --git a/java/org/apache/tomcat/util/codec/binary/BaseNCodec.java b/java/org/apache/tomcat/util/codec/binary/BaseNCodec.java
index 6ca10acaae..3e912a985c 100644
--- a/java/org/apache/tomcat/util/codec/binary/BaseNCodec.java
+++ b/java/org/apache/tomcat/util/codec/binary/BaseNCodec.java
@@ -40,7 +40,7 @@ public abstract class BaseNCodec {
     static class Context {
 
         /**
-         * Place holder for the bytes we're dealing with for our based logic.
+         * Placeholder for the bytes we're dealing with for our based logic.
          * Bitwise operations store and extract the encoding or decoding from this variable.
          */
         int ibitWorkArea;
@@ -78,9 +78,6 @@ public abstract class BaseNCodec {
          */
         int modulus;
 
-        Context() {
-        }
-
         /**
          * Returns a String useful for debugging (especially within a debugger.)
          *
@@ -200,9 +197,7 @@ public abstract class BaseNCodec {
         // Integer.MAX_VALUE length array.
         // The result is that we may have to allocate an array of this size more than once if
         // the capacity must be expanded again.
-        return (minCapacity > MAX_BUFFER_SIZE) ?
-            minCapacity :
-            MAX_BUFFER_SIZE;
+        return Math.max(minCapacity, MAX_BUFFER_SIZE);
     }
 
     /**
@@ -259,7 +254,8 @@ public abstract class BaseNCodec {
         return b;
     }
 
-    protected final byte pad; // instance variable just in case it needs to vary later
+    /** Pad byte. Instance variable just in case it needs to vary later. */
+    protected final byte pad;
 
     /** Number of bytes in each full block of unencoded data, e.g. 4 for Base64 and 5 for Base32 */
     private final int unencodedBlockSize;
@@ -270,7 +266,7 @@ public abstract class BaseNCodec {
     /**
      * Chunksize for encoding. Not used when decoding.
      * A value of zero or less implies no chunking of the encoded data.
-     * Rounded down to nearest multiple of encodedBlockSize.
+     * Rounded down to the nearest multiple of encodedBlockSize.
      */
     protected final int lineLength;
 
@@ -481,7 +477,7 @@ public abstract class BaseNCodec {
      *
      * @param pArray byte[] array which will later be encoded
      *
-     * @return amount of space needed to encoded the supplied array.
+     * @return amount of space needed to encode the supplied array.
      * Returns a long since a max-len array will require &gt; Integer.MAX_VALUE
      */
     public long getEncodedLength(final byte[] pArray) {
diff --git a/java/org/apache/tomcat/util/codec/binary/StringUtils.java b/java/org/apache/tomcat/util/codec/binary/StringUtils.java
index 979313bd8a..6a2b8131f6 100644
--- a/java/org/apache/tomcat/util/codec/binary/StringUtils.java
+++ b/java/org/apache/tomcat/util/codec/binary/StringUtils.java
@@ -41,10 +41,7 @@ public class StringUtils {
      * @return the encoded bytes
      */
     private static byte[] getBytes(final String string, final Charset charset) {
-        if (string == null) {
-            return null;
-        }
-        return string.getBytes(charset);
+        return string == null ? null : string.getBytes(charset);
     }
 
     /**
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index b23d5686cb..ff39b630e3 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -151,10 +151,14 @@
         deprecated in Java 20 onwards, the reasons for deprecation are valid for
         all versions so move away from them now. (markt)
       </scode>
-      <add>
+      <update>
         Update the internal fork of Apache Commons BCEL to b015e90 (2022-11-28,
         6.7.0-RC1). (markt)
-      </add>
+      </update>
+      <update>
+        Update the internal fork of Apache Commons Codec to ae32a3f (2022-11-29,
+        1.16-SNAPSHOT). (markt)
+      </update>
       <update>
         Update to Commons Daemon 1.3.3. (markt)
       </update>


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