From e8901b781728528260c5b3a6a24db73599b93f3c Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Fri, 13 Mar 2026 15:23:54 -0400 Subject: [PATCH] org.apache.commons.compress.utils.ParsingUtils should set the cause of the exceptions it throws --- src/changes/changes.xml | 1 + .../org/apache/commons/compress/utils/ParsingUtils.java | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index b9cfca06b1f..561fe603fb0 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -137,6 +137,7 @@ The type attribute can be add,update,fix,remove. CPUTF8 is missing optional hashCode() and equals() to match its Comparable.compareTo(). Pack200 class IcBands.IcTuple implements equals() but not hashCode(). Fix typos in Javadoc and comments #761. + org.apache.commons.compress.utils.ParsingUtils should set the cause of the exceptions it throws. Add MemoryLimitException.MemoryLimitException(long, long). Add CompressException.CompressException(String, Object...). diff --git a/src/main/java/org/apache/commons/compress/utils/ParsingUtils.java b/src/main/java/org/apache/commons/compress/utils/ParsingUtils.java index 7550edf3ceb..9e7290f50e3 100644 --- a/src/main/java/org/apache/commons/compress/utils/ParsingUtils.java +++ b/src/main/java/org/apache/commons/compress/utils/ParsingUtils.java @@ -49,8 +49,8 @@ public static int parseIntValue(final String value) throws IOException { public static int parseIntValue(final String value, final int radix) throws IOException { try { return Integer.parseInt(value, radix); - } catch (final NumberFormatException exp) { - throw new IOException("Unable to parse int from string value: " + value); + } catch (final NumberFormatException e) { + throw new IOException("Unable to parse int from string value: " + value, e); } } @@ -76,8 +76,8 @@ public static long parseLongValue(final String value) throws IOException { public static long parseLongValue(final String value, final int radix) throws IOException { try { return Long.parseLong(value, radix); - } catch (final NumberFormatException exp) { - throw new IOException("Unable to parse long from string value: " + value); + } catch (final NumberFormatException e) { + throw new IOException("Unable to parse long from string value: " + value, e); } }