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 2026/03/30 11:40:53 UTC

(commons-codec) branch master updated: Internal refactoring

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


The following commit(s) were added to refs/heads/master by this push:
     new f9018bd6 Internal refactoring
f9018bd6 is described below

commit f9018bd6ef446bdcdd23558e62ac0d24f5354053
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Mar 30 07:40:47 2026 -0400

    Internal refactoring
---
 src/main/java/org/apache/commons/codec/digest/DigestUtils.java | 8 ++++++--
 1 file changed, 6 insertions(+), 2 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 c79cd563..1314af11 100644
--- a/src/main/java/org/apache/commons/codec/digest/DigestUtils.java
+++ b/src/main/java/org/apache/commons/codec/digest/DigestUtils.java
@@ -443,7 +443,11 @@ public class DigestUtils {
     }
 
     private static byte[] gitBlobPrefix(final long dataSize) {
-        return ("blob " + dataSize + "\0").getBytes(StandardCharsets.UTF_8);
+        return gitPrefix("blob ", dataSize);
+    }
+
+    private static byte[] gitPrefix(final String prefix, final long dataSize) {
+        return (prefix + dataSize + "\0").getBytes(StandardCharsets.UTF_8);
     }
 
     /**
@@ -505,7 +509,7 @@ public class DigestUtils {
     }
 
     private static byte[] gitTreePrefix(final long dataSize) {
-        return ("tree " + dataSize + "\0").getBytes(StandardCharsets.UTF_8);
+        return gitPrefix("tree ", dataSize);
     }
 
     /**