You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/11/20 22:03:20 UTC

[commons-fileupload] branch master updated: Use Arrays.fill(). Normalize spelling of 'Initialize'.

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

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-fileupload.git


The following commit(s) were added to refs/heads/master by this push:
     new e70b8ca  Use Arrays.fill(). Normalize spelling of 'Initialize'.
e70b8ca is described below

commit e70b8ca77e10a6ca42362dcc96ec9c2ebcb93afb
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Nov 20 17:03:15 2020 -0500

    Use Arrays.fill(). Normalize spelling of 'Initialize'.
---
 .../apache/commons/fileupload2/util/mime/Base64Decoder.java   | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/apache/commons/fileupload2/util/mime/Base64Decoder.java b/src/main/java/org/apache/commons/fileupload2/util/mime/Base64Decoder.java
index 05d05cb..4c9d0b5 100644
--- a/src/main/java/org/apache/commons/fileupload2/util/mime/Base64Decoder.java
+++ b/src/main/java/org/apache/commons/fileupload2/util/mime/Base64Decoder.java
@@ -18,6 +18,7 @@ package org.apache.commons.fileupload2.util.mime;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 
 /**
  * @since 1.3
@@ -27,10 +28,10 @@ final class Base64Decoder {
     /**
      * Decoding table value for invalid bytes.
      */
-    private static final int INVALID_BYTE = -1; // must be outside range 0-63
+    private static final byte INVALID_BYTE = -1; // must be outside range 0-63
 
     /**
-     * Decoding table value for padding bytes, so can detect PAD afer conversion.
+     * Decoding table value for padding bytes, so can detect PAD after conversion.
      */
     private static final int PAD_BYTE = -2; // must be outside range 0-63
 
@@ -74,10 +75,8 @@ final class Base64Decoder {
     private static final byte[] DECODING_TABLE = new byte[Byte.MAX_VALUE - Byte.MIN_VALUE + 1];
 
     static {
-        // Initialise as all invalid characters
-        for (int i = 0; i < DECODING_TABLE.length; i++) {
-            DECODING_TABLE[i] = INVALID_BYTE;
-        }
+        // Initialize as all invalid characters
+        Arrays.fill(DECODING_TABLE, INVALID_BYTE);
         // set up valid characters
         for (int i = 0; i < ENCODING_TABLE.length; i++) {
             DECODING_TABLE[ENCODING_TABLE[i]] = (byte) i;