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 00bfe4a5 Internal refactoring
00bfe4a5 is described below
commit 00bfe4a5f46af2b582820b4cde3db45148075092
Author: Gary Gregory <[email protected]>
AuthorDate: Sat Apr 4 07:45:53 2026 -0400
Internal refactoring
---
src/main/java/org/apache/commons/codec/binary/Base58.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/apache/commons/codec/binary/Base58.java
b/src/main/java/org/apache/commons/codec/binary/Base58.java
index aa0b1851..7dd3eee8 100644
--- a/src/main/java/org/apache/commons/codec/binary/Base58.java
+++ b/src/main/java/org/apache/commons/codec/binary/Base58.java
@@ -53,6 +53,8 @@ import java.util.WeakHashMap;
*/
public class Base58 extends BaseNCodec {
+ private static final byte[] EMPTY = new byte[0];
+
/**
* Builds {@link Base58} instances with custom configuration.
*/
@@ -217,14 +219,14 @@ public class Base58 extends BaseNCodec {
}
if (length < 0) {
context.eof = true;
- final byte[] accumulate = accumulated.getOrDefault(context, new
byte[0]);
+ final byte[] accumulate = accumulated.getOrDefault(context, EMPTY);
if (accumulate.length > 0) {
convertFromBase58(accumulate, context);
}
accumulated.remove(context);
return;
}
- final byte[] accumulate = accumulated.getOrDefault(context, new
byte[0]);
+ final byte[] accumulate = accumulated.getOrDefault(context, EMPTY);
final byte[] newAccumulated = new byte[accumulate.length + length];
if (accumulate.length > 0) {
System.arraycopy(accumulate, 0, newAccumulated, 0,
accumulate.length);
@@ -251,12 +253,12 @@ public class Base58 extends BaseNCodec {
}
if (length < 0) {
context.eof = true;
- final byte[] accumulate = accumulated.getOrDefault(context, new
byte[0]);
+ final byte[] accumulate = accumulated.getOrDefault(context, EMPTY);
convertToBase58(accumulate, context);
accumulated.remove(context);
return;
}
- final byte[] accumulate = accumulated.getOrDefault(context, new
byte[0]);
+ final byte[] accumulate = accumulated.getOrDefault(context, EMPTY);
final byte[] newAccumulated = new byte[accumulate.length + length];
if (accumulate.length > 0) {
System.arraycopy(accumulate, 0, newAccumulated, 0,
accumulate.length);