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 2024/01/08 13:06:25 UTC

(commons-codec) branch master updated (4d6860e2 -> a3d9ecaf)

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

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


    from 4d6860e2 Update NOTICE file for 2024
     new 61ceff6e Update internal name
     new 608ef907 Javadoc
     new a3d9ecaf Reuse package-private constant

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/commons/codec/digest/DigestUtils.java   | 13 ++++++++-----
 .../org/apache/commons/codec/digest/DigestUtilsTest.java    |  2 +-
 2 files changed, 9 insertions(+), 6 deletions(-)


(commons-codec) 03/03: Reuse package-private constant

Posted by gg...@apache.org.
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-codec.git

commit a3d9ecaf25dd5e6a1eaa87f7d8756867e1a638ea
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 8 08:06:20 2024 -0500

    Reuse package-private constant
---
 src/test/java/org/apache/commons/codec/digest/DigestUtilsTest.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/codec/digest/DigestUtilsTest.java b/src/test/java/org/apache/commons/codec/digest/DigestUtilsTest.java
index 039b826e..7b5baf9d 100644
--- a/src/test/java/org/apache/commons/codec/digest/DigestUtilsTest.java
+++ b/src/test/java/org/apache/commons/codec/digest/DigestUtilsTest.java
@@ -56,7 +56,7 @@ public class DigestUtilsTest {
 
     private static final String EMPTY_STRING = "";
 
-    private final byte[] testData = new byte[1024 * 1024];
+    private final byte[] testData = new byte[DigestUtils.BUFFER_SIZE * DigestUtils.BUFFER_SIZE];
 
     private Path testFile;
 


(commons-codec) 01/03: Update internal name

Posted by gg...@apache.org.
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-codec.git

commit 61ceff6e6194913e0bcc47744d4e113edc73fbb2
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 8 08:04:53 2024 -0500

    Update internal name
---
 src/main/java/org/apache/commons/codec/digest/DigestUtils.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/commons/codec/digest/DigestUtils.java b/src/main/java/org/apache/commons/codec/digest/DigestUtils.java
index f5cc1dd4..85e42861 100644
--- a/src/main/java/org/apache/commons/codec/digest/DigestUtils.java
+++ b/src/main/java/org/apache/commons/codec/digest/DigestUtils.java
@@ -57,7 +57,7 @@ import org.apache.commons.codec.binary.StringUtils;
  */
 public class DigestUtils {
 
-    private static final int STREAM_BUFFER_LENGTH = 1024;
+    private static final int BUFFER_SIZE = 1024;
 
     /**
      * Reads through a byte array and returns the digest for the data. Provided for symmetry with other methods.
@@ -1291,7 +1291,7 @@ public class DigestUtils {
      * @since 1.14
      */
     private static MessageDigest updateDigest(final MessageDigest digest, final FileChannel data) throws IOException {
-        final ByteBuffer buffer = ByteBuffer.allocate(STREAM_BUFFER_LENGTH);
+        final ByteBuffer buffer = ByteBuffer.allocate(BUFFER_SIZE);
         while (data.read(buffer) > 0) {
             buffer.flip();
             digest.update(buffer);
@@ -1310,12 +1310,12 @@ public class DigestUtils {
      * @since 1.8
      */
     public static MessageDigest updateDigest(final MessageDigest digest, final InputStream inputStream) throws IOException {
-        final byte[] buffer = new byte[STREAM_BUFFER_LENGTH];
-        int read = inputStream.read(buffer, 0, STREAM_BUFFER_LENGTH);
+        final byte[] buffer = new byte[BUFFER_SIZE];
+        int read = inputStream.read(buffer, 0, BUFFER_SIZE);
 
         while (read > -1) {
             digest.update(buffer, 0, read);
-            read = inputStream.read(buffer, 0, STREAM_BUFFER_LENGTH);
+            read = inputStream.read(buffer, 0, BUFFER_SIZE);
         }
 
         return digest;


(commons-codec) 02/03: Javadoc

Posted by gg...@apache.org.
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-codec.git

commit 608ef907adc9a3b05e1323b57277d07ab7b017bf
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 8 08:06:07 2024 -0500

    Javadoc
---
 src/main/java/org/apache/commons/codec/digest/DigestUtils.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/codec/digest/DigestUtils.java b/src/main/java/org/apache/commons/codec/digest/DigestUtils.java
index 85e42861..70d2f0c4 100644
--- a/src/main/java/org/apache/commons/codec/digest/DigestUtils.java
+++ b/src/main/java/org/apache/commons/codec/digest/DigestUtils.java
@@ -57,7 +57,10 @@ import org.apache.commons.codec.binary.StringUtils;
  */
 public class DigestUtils {
 
-    private static final int BUFFER_SIZE = 1024;
+    /**
+     * Package-private for tests.
+     */
+    static final int BUFFER_SIZE = 1024;
 
     /**
      * Reads through a byte array and returns the digest for the data. Provided for symmetry with other methods.