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-compress.git
commit 2280d66e238d2b9138bb31de707cfb8347ef0267 Author: Gary Gregory <[email protected]> AuthorDate: Sun Aug 9 18:51:31 2026 -0400 ParsingUtils now throws the IOException subclass CompressException. --- src/changes/changes.xml | 1 + .../commons/compress/utils/ParsingUtils.java | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 40688e169..848844988 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -168,6 +168,7 @@ The <action> type attribute can be add,update,fix,remove. <action type="fix" dev="ggregory" due-to="Gary Gregory">TarArchiveEntry.setDevMajor(int) now throw ArchiveException instead of IllegalArgumentException.</action> <action type="fix" dev="ggregory" due-to="Gary Gregory">TarArchiveEntry.setDevMinor(int) now throw ArchiveException instead of IllegalArgumentException.</action> <action type="fix" dev="ggregory" due-to="Gary Gregory">TarArchiveEntry.setSize(long) now throw ArchiveException instead of IllegalArgumentException.</action> + <action type="fix" dev="ggregory" due-to="Gary Gregory">ParsingUtils now throws the IOException subclass CompressException.</action> <!-- ADD --> <action type="add" dev="ggregory" due-to="Gary Gregory">Add MemoryLimitException.MemoryLimitException(long, long).</action> <action type="add" dev="ggregory" due-to="Gary Gregory">Add CompressException.CompressException(String, Object...).</action> 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 8fd3148cb..c62e5b9a4 100644 --- a/src/main/java/org/apache/commons/compress/utils/ParsingUtils.java +++ b/src/main/java/org/apache/commons/compress/utils/ParsingUtils.java @@ -18,7 +18,7 @@ */ package org.apache.commons.compress.utils; -import java.io.IOException; +import org.apache.commons.compress.CompressException; /** * Utility methods for parsing data and converting it to other formats. @@ -32,9 +32,9 @@ public final class ParsingUtils { * * @param value string value to parse. * @return parsed value as an int. - * @throws IOException when the value cannot be parsed. + * @throws CompressException when the value cannot be parsed. */ - public static int parseIntValue(final String value) throws IOException { + public static int parseIntValue(final String value) throws CompressException { return parseIntValue(value, 10); } @@ -44,13 +44,13 @@ public static int parseIntValue(final String value) throws IOException { * @param value string value to parse. * @param radix radix value to use for parsing. * @return parsed value as an int. - * @throws IOException when the value cannot be parsed. + * @throws CompressException when the value cannot be parsed. */ - public static int parseIntValue(final String value, final int radix) throws IOException { + public static int parseIntValue(final String value, final int radix) throws CompressException { try { return Integer.parseInt(value, radix); } catch (final NumberFormatException e) { - throw new IOException("Unable to parse int from string value: " + value, e); + throw new CompressException("Unable to parse int from string value: " + value, e); } } @@ -59,9 +59,9 @@ public static int parseIntValue(final String value, final int radix) throws IOEx * * @param value string value to parse. * @return parsed value as a long. - * @throws IOException when the value cannot be parsed. + * @throws CompressException when the value cannot be parsed. */ - public static long parseLongValue(final String value) throws IOException { + public static long parseLongValue(final String value) throws CompressException { return parseLongValue(value, 10); } @@ -71,13 +71,13 @@ public static long parseLongValue(final String value) throws IOException { * @param value string value to parse. * @param radix radix value to use for parsing. * @return parsed value as a long. - * @throws IOException when the value cannot be parsed. + * @throws CompressException when the value cannot be parsed. */ - public static long parseLongValue(final String value, final int radix) throws IOException { + public static long parseLongValue(final String value, final int radix) throws CompressException { try { return Long.parseLong(value, radix); } catch (final NumberFormatException e) { - throw new IOException("Unable to parse long from string value: " + value, e); + throw new CompressException("Unable to parse long from string value: " + value, e); } }
