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

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

commit 6ff959dfcb12a53663eab4936d1d280218af8d74
Author: Gary Gregory <[email protected]>
AuthorDate: Sat Aug 8 17:15:34 2026 -0400

    Throw DecoderException instead of IllegalArgumentException in
    RFC1522Codec.decodeText(String).
---
 src/changes/changes.xml                            |  1 +
 .../java/org/apache/commons/codec/net/BCodec.java  | 22 +++++++++++++++++++---
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 18a255c6..2a70e666 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -51,6 +51,7 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="fix" dev="ggregory" due-to="Yu Bao, Gary Gregory">Allocate 
a single MessageDigest and use it in Sha2Crypt.sha2Crypt(byte[], String, 
String, int, String).</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Javadoc 
improvements.</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Throw 
IOException instead of IllegalArgumentException in BaseNCodecOutputStream and 
BaseNCodecOutputStream IO methods.</action>
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">Throw 
DecoderException instead of IllegalArgumentException in 
RFC1522Codec.decodeText(String)..</action>
       <!-- ADD -->
       <action type="add" dev="ggregory" due-to="Gary Gregory">Add and use 
PhoneticEngine.Builder and deprecate old constructors.</action>
       <action type="add" dev="ggregory" due-to="Gary Gregory">Add 
BeiderMorseEncoder.Builder and deprecate old constructor.</action>
diff --git a/src/main/java/org/apache/commons/codec/net/BCodec.java 
b/src/main/java/org/apache/commons/codec/net/BCodec.java
index 79d77115..17a033a0 100644
--- a/src/main/java/org/apache/commons/codec/net/BCodec.java
+++ b/src/main/java/org/apache/commons/codec/net/BCodec.java
@@ -149,13 +149,29 @@ public class BCodec extends RFC1522Codec implements 
StringEncoder, StringDecoder
         }
     }
 
+    /**
+     * {@inheritDoc}
+     *
+     * @throws IllegalArgumentException Thrown when a problem is detected 
processing data.
+     */
     @Override
-    protected byte[] doDecoding(final byte[] bytes) {
+    protected byte[] doDecoding(final byte[] bytes) throws DecoderException {
         if (bytes == null) {
             return null;
         }
-        return 
Base64.builder().setLineLength(0).setLineSeparator(BaseNCodec.getChunkSeparator()).setUrlSafe(false).setDecodingPolicy(decodingPolicy).get()
-                .decode(bytes);
+        // @formatter:off
+        try {
+            return Base64.builder()
+                    .setLineLength(0)
+                    .setLineSeparator(BaseNCodec.getChunkSeparator())
+                    .setUrlSafe(false)
+                    .setDecodingPolicy(decodingPolicy)
+                    .get()
+                    .decode(bytes);
+        } catch (final IllegalArgumentException e) {
+            throw new DecoderException(e.getMessage(), e);
+        }
+        // @formatter:on
     }
 
     @Override

Reply via email to