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 2025/07/19 13:16:40 UTC
(commons-codec) 05/17: The method org.apache.commons.codec.binary.BaseNCodec.AbstractBuilder.setLineSeparator(byte...) now makes a defensive copy
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 f49428a2965ef94a677d82db3a4ccddfe628f160
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sat Jul 19 07:53:49 2025 -0400
The method
org.apache.commons.codec.binary.BaseNCodec.AbstractBuilder.setLineSeparator(byte...)
now makes a defensive copy
---
src/changes/changes.xml | 1 +
src/main/java/org/apache/commons/codec/binary/BaseNCodec.java | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 01a19f83..06814158 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -64,6 +64,7 @@ The <action> type attribute can be add,update,fix,remove.
<action type="fix" dev="ggregory" due-to="Gary Gregory">Fix PMD UnnecessaryFullyQualifiedName in org.apache.commons.codec.digest.Md5Crypt.</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">Fix PMD EmptyControlStatement in org.apache.commons.codec.language.Metaphone.</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">Fix SpotBugs [ERROR] Medium: org.apache.commons.codec.binary.BaseNCodec$AbstractBuilder.setEncodeTable(byte[]) may expose internal representation by storing an externally mutable object into BaseNCodec$AbstractBuilder.encodeTable [org.apache.commons.codec.binary.BaseNCodec$AbstractBuilder] At BaseNCodec.java:[line 131] EI_EXPOSE_REP2.</action>
+ <action type="fix" dev="ggregory" due-to="Gary Gregory">The method org.apache.commons.codec.binary.BaseNCodec.AbstractBuilder.setLineSeparator(byte...) now makes a defensive copy.</action>
<!-- ADD -->
<action type="add" dev="ggregory" due-to="Gary Gregory">Add HmacUtils.hmac(Path).</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Add HmacUtils.hmacHex(Path).</action>
diff --git a/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java b/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java
index f1f979ef..2ab1eb07 100644
--- a/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java
+++ b/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java
@@ -150,7 +150,7 @@ public abstract class BaseNCodec implements BinaryEncoder, BinaryDecoder {
* @return {@code this} instance.
*/
public B setLineSeparator(final byte... lineSeparator) {
- this.lineSeparator = lineSeparator != null ? lineSeparator : CHUNK_SEPARATOR;
+ this.lineSeparator = lineSeparator != null ? lineSeparator.clone() : CHUNK_SEPARATOR;
return asThis();
}