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 2022/09/30 12:41:00 UTC
[commons-compress] 01/02: Replace throwing "impossible" RuntimeException with UncheckedIOException
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-compress.git
commit 973ebddb4cc5f9216f56b9e5e29b3b9aaa3dc5e6
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Sep 30 08:36:05 2022 -0400
Replace throwing "impossible" RuntimeException with UncheckedIOException
---
.../org/apache/commons/compress/archivers/tar/TarArchiveEntry.java | 5 +++--
.../java/org/apache/commons/compress/archivers/tar/TarUtils.java | 4 ++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
index 8f8c06cb..7efc2fa4 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
@@ -20,6 +20,7 @@ package org.apache.commons.compress.archivers.tar;
import java.io.File;
import java.io.IOException;
+import java.io.UncheckedIOException;
import java.math.BigDecimal;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
@@ -1467,7 +1468,7 @@ public class TarArchiveEntry implements ArchiveEntry, TarConstants, EntryStreamO
parseTarHeader(header, TarUtils.DEFAULT_ENCODING, true, false);
} catch (final IOException ex2) {
// not really possible
- throw new RuntimeException(ex2); //NOSONAR
+ throw new UncheckedIOException(ex2); //NOSONAR
}
}
}
@@ -2035,7 +2036,7 @@ public class TarArchiveEntry implements ArchiveEntry, TarConstants, EntryStreamO
writeEntryHeader(outbuf, TarUtils.FALLBACK_ENCODING, false);
} catch (final IOException ex2) {
// impossible
- throw new RuntimeException(ex2); //NOSONAR
+ throw new UncheckedIOException(ex2); //NOSONAR
}
}
}
diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
index 7aeaa2f9..44ba57ae 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
@@ -279,7 +279,7 @@ public class TarUtils {
return parseName(buffer, offset, length, FALLBACK_ENCODING);
} catch (final IOException ex2) {
// impossible
- throw new RuntimeException(ex2); //NOSONAR
+ throw new UncheckedIOException(ex2); //NOSONAR
}
}
}
@@ -378,7 +378,7 @@ public class TarUtils {
FALLBACK_ENCODING);
} catch (final IOException ex2) {
// impossible
- throw new RuntimeException(ex2); //NOSONAR
+ throw new UncheckedIOException(ex2); //NOSONAR
}
}
}