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
The following commit(s) were added to refs/heads/master by this push: new 39abfb1 Remove unused exceptions. 39abfb1 is described below commit 39abfb17b02acd7d07b0c3ff5bac666a7bd35ea7 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Tue Feb 8 18:12:46 2022 -0500 Remove unused exceptions. --- .../apache/commons/compress/archivers/examples/Archiver.java | 3 +-- .../apache/commons/compress/archivers/examples/Expander.java | 12 ++++-------- .../commons/compress/archivers/sevenz/SevenZOutputFile.java | 7 ++----- .../compress/archivers/zip/UnshrinkingInputStream.java | 3 +-- .../compress/archivers/zip/ZipArchiveOutputStream.java | 3 +-- .../compressors/deflate/DeflateCompressorOutputStream.java | 6 ++---- .../compressors/lz4/BlockLZ4CompressorInputStream.java | 4 +--- .../compressors/lz4/BlockLZ4CompressorOutputStream.java | 8 ++------ .../lz77support/AbstractLZ77CompressorInputStream.java | 3 +-- 9 files changed, 15 insertions(+), 34 deletions(-) diff --git a/src/main/java/org/apache/commons/compress/archivers/examples/Archiver.java b/src/main/java/org/apache/commons/compress/archivers/examples/Archiver.java index f94909d..cdbe7b7 100644 --- a/src/main/java/org/apache/commons/compress/archivers/examples/Archiver.java +++ b/src/main/java/org/apache/commons/compress/archivers/examples/Archiver.java @@ -104,9 +104,8 @@ public class Archiver { * @param target the stream to write the new archive to. * @param directory the directory that contains the files to archive. * @throws IOException if an I/O error occurs - * @throws ArchiveException if the archive cannot be created for other reasons */ - public void create(final ArchiveOutputStream target, final File directory) throws IOException, ArchiveException { + public void create(final ArchiveOutputStream target, final File directory) throws IOException { create(target, directory.toPath(), EMPTY_FileVisitOption); } diff --git a/src/main/java/org/apache/commons/compress/archivers/examples/Expander.java b/src/main/java/org/apache/commons/compress/archivers/examples/Expander.java index d256df9..0271268 100644 --- a/src/main/java/org/apache/commons/compress/archivers/examples/Expander.java +++ b/src/main/java/org/apache/commons/compress/archivers/examples/Expander.java @@ -259,10 +259,9 @@ public class Expander { * @param archive the file to expand * @param targetDirectory the directory to write to * @throws IOException if an I/O error occurs - * @throws ArchiveException if the archive cannot be read for other reasons */ public void expand(final ArchiveInputStream archive, final File targetDirectory) - throws IOException, ArchiveException { + throws IOException { expand(() -> { ArchiveEntry next = archive.getNextEntry(); while (next != null && !archive.canReadEntryData(next)) { @@ -278,11 +277,10 @@ public class Expander { * @param archive the file to expand * @param targetDirectory the directory to write to * @throws IOException if an I/O error occurs - * @throws ArchiveException if the archive cannot be read for other reasons * @since 1.21 */ public void expand(final TarFile archive, final File targetDirectory) - throws IOException, ArchiveException { + throws IOException { final Iterator<TarArchiveEntry> entryIterator = archive.getEntries().iterator(); expand(() -> entryIterator.hasNext() ? entryIterator.next() : null, (entry, out) -> { @@ -298,10 +296,9 @@ public class Expander { * @param archive the file to expand * @param targetDirectory the directory to write to * @throws IOException if an I/O error occurs - * @throws ArchiveException if the archive cannot be read for other reasons */ public void expand(final ZipFile archive, final File targetDirectory) - throws IOException, ArchiveException { + throws IOException { final Enumeration<ZipArchiveEntry> entries = archive.getEntries(); expand(() -> { ZipArchiveEntry next = entries.hasMoreElements() ? entries.nextElement() : null; @@ -322,10 +319,9 @@ public class Expander { * @param archive the file to expand * @param targetDirectory the directory to write to * @throws IOException if an I/O error occurs - * @throws ArchiveException if the archive cannot be read for other reasons */ public void expand(final SevenZFile archive, final File targetDirectory) - throws IOException, ArchiveException { + throws IOException { expand(archive::getNextEntry, (entry, out) -> { final byte[] buffer = new byte[8192]; int n; diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java index b1ba333..6096183 100644 --- a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java +++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java @@ -152,11 +152,9 @@ public class SevenZOutputFile implements Closeable { * @param inputFile file to create an entry from * @param entryName the name to use * @return the ArchiveEntry set up with details from the file - * - * @throws IOException on error */ public SevenZArchiveEntry createArchiveEntry(final File inputFile, - final String entryName) throws IOException { + final String entryName) { final SevenZArchiveEntry entry = new SevenZArchiveEntry(); entry.setDirectory(inputFile.isDirectory()); entry.setName(entryName); @@ -191,9 +189,8 @@ public class SevenZOutputFile implements Closeable { * {@link #closeArchiveEntry()} to complete the process. * * @param archiveEntry describes the entry - * @throws IOException on error */ - public void putArchiveEntry(final ArchiveEntry archiveEntry) throws IOException { + public void putArchiveEntry(final ArchiveEntry archiveEntry) { final SevenZArchiveEntry entry = (SevenZArchiveEntry) archiveEntry; files.add(entry); } diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/UnshrinkingInputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/UnshrinkingInputStream.java index 685bce9..c829282 100644 --- a/src/main/java/org/apache/commons/compress/archivers/zip/UnshrinkingInputStream.java +++ b/src/main/java/org/apache/commons/compress/archivers/zip/UnshrinkingInputStream.java @@ -38,9 +38,8 @@ class UnshrinkingInputStream extends LZWInputStream { * IOException is not actually thrown! * * @param inputStream - * @throws IOException IOException is not actually thrown! */ - public UnshrinkingInputStream(final InputStream inputStream) throws IOException { + public UnshrinkingInputStream(final InputStream inputStream) { super(inputStream, ByteOrder.LITTLE_ENDIAN); setClearCode(DEFAULT_CODE_SIZE); initializeTables(MAX_CODE_SIZE); diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java index abcccf7..5c4f06b 100644 --- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java +++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java @@ -401,10 +401,9 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream { * access.</p> * * @param channel the channel to zip to - * @throws IOException on error * @since 1.13 */ - public ZipArchiveOutputStream(final SeekableByteChannel channel) throws IOException { + public ZipArchiveOutputStream(final SeekableByteChannel channel) { this.channel = channel; def = new Deflater(level, true); streamCompressor = StreamCompressor.create(channel, def); diff --git a/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStream.java b/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStream.java index a12ec54..62fb1b7 100644 --- a/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStream.java +++ b/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStream.java @@ -36,9 +36,8 @@ public class DeflateCompressorOutputStream extends CompressorOutputStream { /** * Creates a Deflate compressed output stream with the default parameters. * @param outputStream the stream to wrap - * @throws IOException on error */ - public DeflateCompressorOutputStream(final OutputStream outputStream) throws IOException { + public DeflateCompressorOutputStream(final OutputStream outputStream) { this(outputStream, new DeflateParameters()); } @@ -46,10 +45,9 @@ public class DeflateCompressorOutputStream extends CompressorOutputStream { * Creates a Deflate compressed output stream with the specified parameters. * @param outputStream the stream to wrap * @param parameters the deflate parameters to apply - * @throws IOException on error */ public DeflateCompressorOutputStream(final OutputStream outputStream, - final DeflateParameters parameters) throws IOException { + final DeflateParameters parameters) { this.deflater = new Deflater(parameters.getCompressionLevel(), !parameters.withZlibHeader()); this.out = new DeflaterOutputStream(outputStream, deflater); } diff --git a/src/main/java/org/apache/commons/compress/compressors/lz4/BlockLZ4CompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/lz4/BlockLZ4CompressorInputStream.java index 94bd157..6032c16 100644 --- a/src/main/java/org/apache/commons/compress/compressors/lz4/BlockLZ4CompressorInputStream.java +++ b/src/main/java/org/apache/commons/compress/compressors/lz4/BlockLZ4CompressorInputStream.java @@ -49,10 +49,8 @@ public class BlockLZ4CompressorInputStream extends AbstractLZ77CompressorInputSt * * @param is * An InputStream to read compressed data from - * - * @throws IOException if reading fails */ - public BlockLZ4CompressorInputStream(final InputStream is) throws IOException { + public BlockLZ4CompressorInputStream(final InputStream is) { super(is, WINDOW_SIZE); } diff --git a/src/main/java/org/apache/commons/compress/compressors/lz4/BlockLZ4CompressorOutputStream.java b/src/main/java/org/apache/commons/compress/compressors/lz4/BlockLZ4CompressorOutputStream.java index a0550f6..699edea 100644 --- a/src/main/java/org/apache/commons/compress/compressors/lz4/BlockLZ4CompressorOutputStream.java +++ b/src/main/java/org/apache/commons/compress/compressors/lz4/BlockLZ4CompressorOutputStream.java @@ -93,10 +93,8 @@ public class BlockLZ4CompressorOutputStream extends CompressorOutputStream { * * @param os * An OutputStream to read compressed data from - * - * @throws IOException if reading fails */ - public BlockLZ4CompressorOutputStream(final OutputStream os) throws IOException { + public BlockLZ4CompressorOutputStream(final OutputStream os) { this(os, createParameterBuilder().build()); } @@ -107,10 +105,8 @@ public class BlockLZ4CompressorOutputStream extends CompressorOutputStream { * An OutputStream to read compressed data from * @param params * The parameters to use for LZ77 compression. - * - * @throws IOException if reading fails */ - public BlockLZ4CompressorOutputStream(final OutputStream os, final Parameters params) throws IOException { + public BlockLZ4CompressorOutputStream(final OutputStream os, final Parameters params) { this.os = os; compressor = new LZ77Compressor(params, block -> { diff --git a/src/main/java/org/apache/commons/compress/compressors/lz77support/AbstractLZ77CompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/lz77support/AbstractLZ77CompressorInputStream.java index d08b22d..8368e8f 100644 --- a/src/main/java/org/apache/commons/compress/compressors/lz77support/AbstractLZ77CompressorInputStream.java +++ b/src/main/java/org/apache/commons/compress/compressors/lz77support/AbstractLZ77CompressorInputStream.java @@ -124,10 +124,9 @@ public abstract class AbstractLZ77CompressorInputStream extends CompressorInputS * @param windowSize * Size of the window kept for back-references, must be bigger than the biggest offset expected. * - * @throws IOException if reading fails * @throws IllegalArgumentException if windowSize is not bigger than 0 */ - public AbstractLZ77CompressorInputStream(final InputStream is, final int windowSize) throws IOException { + public AbstractLZ77CompressorInputStream(final InputStream is, final int windowSize) { this.in = new CountingInputStream(is); if (windowSize <= 0) { throw new IllegalArgumentException("windowSize must be bigger than 0");