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 87e2f175660a059d91bc95b97eb482fb14dafd56 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Mon Jan 15 11:09:40 2024 -0500 Remove extra ; - Use final - Remove cast - Remove unused import - Format tweak --- .../archivers/ar/ArArchiveInputStream.java | 4 +-- .../compress/archivers/examples/Archiver.java | 2 +- .../compress/archivers/examples/Expander.java | 2 +- .../archivers/sevenz/AES256SHA256Decoder.java | 4 +-- .../compress/archivers/zip/ExtraFieldUtils.java | 2 +- .../zip/FileRandomAccessOutputStream.java | 6 ++-- .../archivers/zip/RandomAccessOutputStream.java | 2 +- .../SeekableChannelRandomAccessOutputStream.java | 2 +- .../compress/archivers/zip/ZipArchiveEntry.java | 2 +- .../archivers/zip/ZipArchiveOutputStream.java | 2 +- .../commons/compress/archivers/zip/ZipFile.java | 32 +++++++++--------- .../commons/compress/archivers/zip/ZipIoUtil.java | 12 +++---- .../archivers/zip/ZipSplitOutputStream.java | 14 ++++---- .../zip/ZipSplitReadOnlySeekableByteChannel.java | 2 +- .../gzip/GzipCompressorInputStream.java | 2 +- .../lz4/FramedLZ4CompressorOutputStream.java | 2 +- .../snappy/FramedSnappyCompressorInputStream.java | 2 +- .../harmony/pack200/NewAttributeBands.java | 4 +-- .../org/apache/commons/compress/utils/IOUtils.java | 2 +- .../org/apache/commons/compress/AbstractTest.java | 4 +-- .../apache/commons/compress/ArchiveReadTest.java | 2 +- .../archivers/ArchiveStreamFactoryTest.java | 10 +++--- .../commons/compress/archivers/LongPathTest.java | 2 +- .../compress/archivers/LongSymLinkTest.java | 2 +- .../apache/commons/compress/archivers/TarTest.java | 2 +- .../apache/commons/compress/archivers/ZipTest.java | 38 +++++++++++----------- .../archivers/tar/TarArchiveEntryTest.java | 4 +-- .../archivers/tar/TarArchiveInputStreamTest.java | 4 +-- .../compress/archivers/tar/TarFileTest.java | 2 +- .../zip/FileRandomAccessOutputStreamTest.java | 22 ++++++------- .../zip/ParallelScatterZipCreatorTest.java | 14 ++++---- .../zip/RandomAccessOutputStreamTest.java | 8 ++--- ...eekableChannelRandomAccessOutputStreamTest.java | 22 ++++++------- .../archivers/zip/X5455_ExtendedTimestampTest.java | 2 +- .../compress/archivers/zip/Zip64SupportIT.java | 8 ++--- .../archivers/zip/ZipArchiveInputStreamTest.java | 2 +- .../compress/archivers/zip/ZipFileTest.java | 1 - .../compress/archivers/zip/ZipIoUtilTest.java | 20 +++++------- .../archivers/zip/ZipMemoryFileSystemTest.java | 2 +- .../compress/compressors/DetectCompressorTest.java | 2 +- .../harmony/pack200/tests/ArchiveTest.java | 4 +-- .../harmony/pack200/tests/BHSDCodecTest.java | 2 +- .../harmony/pack200/tests/PackingOptionsTest.java | 14 ++++---- .../harmony/unpack200/tests/AbstractBandsTest.java | 4 +-- .../harmony/unpack200/tests/ArchiveTest.java | 4 +-- .../utils/FixedLengthBlockOutputStreamTest.java | 2 +- 46 files changed, 147 insertions(+), 156 deletions(-) diff --git a/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java index 9361801de..ed1d8c3b8 100644 --- a/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java +++ b/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java @@ -315,7 +315,7 @@ public class ArArchiveInputStream extends ArchiveInputStream<ArArchiveEntry> { long len; try { len = asLong(metaData, LENGTH_OFFSET, LENGTH_LEN); - } catch (NumberFormatException ex) { + } catch (final NumberFormatException ex) { throw new IOException("Broken archive, unable to parse ar_size field as a number", ex); } if (temp.endsWith("/")) { // GNU terminator @@ -398,7 +398,7 @@ public class ArArchiveInputStream extends ArchiveInputStream<ArArchiveEntry> { int bufflen; try { bufflen = asInt(length, offset, len); // Assume length will fit in an int - } catch (NumberFormatException ex) { + } catch (final NumberFormatException ex) { throw new IOException("Broken archive, unable to parse GNU string table length field as a number", ex); } 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 2d5d6f86c..784961240 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 @@ -235,7 +235,7 @@ public class Archiver { public void create(final String format, final OutputStream target, final File directory, final CloseableConsumer closeableConsumer) throws IOException, ArchiveException { try (CloseableConsumerAdapter c = new CloseableConsumerAdapter(closeableConsumer)) { - ArchiveOutputStream<? extends ArchiveEntry> archiveOutputStream = ArchiveStreamFactory.DEFAULT.createArchiveOutputStream(format, target); + final ArchiveOutputStream<? extends ArchiveEntry> archiveOutputStream = ArchiveStreamFactory.DEFAULT.createArchiveOutputStream(format, target); create(c.track(archiveOutputStream), directory); } } 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 d3e099b84..f8325891e 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 @@ -316,7 +316,7 @@ public class Expander { public void expand(final String format, final InputStream archive, final Path targetDirectory, final CloseableConsumer closeableConsumer) throws IOException, ArchiveException { try (CloseableConsumerAdapter c = new CloseableConsumerAdapter(closeableConsumer)) { - ArchiveInputStream<?> archiveInputStream = ArchiveStreamFactory.DEFAULT.createArchiveInputStream(format, archive); + final ArchiveInputStream<?> archiveInputStream = ArchiveStreamFactory.DEFAULT.createArchiveInputStream(format, archive); expand(c.track(archiveInputStream), targetDirectory); } } diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256SHA256Decoder.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256SHA256Decoder.java index 15e204e2e..a1bfecf1d 100644 --- a/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256SHA256Decoder.java +++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256SHA256Decoder.java @@ -46,7 +46,7 @@ final class AES256SHA256Decoder extends AbstractCoder { private boolean isInitialized; private CipherInputStream cipherInputStream; - private AES256SHA256DecoderInputStream(InputStream in, Coder coder, String archiveName, byte[] passwordBytes) { + private AES256SHA256DecoderInputStream(final InputStream in, final Coder coder, final String archiveName, final byte[] passwordBytes) { this.in = in; this.coder = coder; this.archiveName = archiveName; @@ -130,7 +130,7 @@ final class AES256SHA256Decoder extends AbstractCoder { private final byte[] cipherBlockBuffer; private int count; - private AES256SHA256DecoderOutputStream(AES256Options opts, OutputStream out) { + private AES256SHA256DecoderOutputStream(final AES256Options opts, final OutputStream out) { cipherOutputStream = new CipherOutputStream(out, opts.getCipher()); cipherBlockSize = opts.getCipher().getBlockSize(); cipherBlockBuffer = new byte[cipherBlockSize]; diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtils.java b/src/main/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtils.java index 12a0acf1e..4dc6cb85d 100644 --- a/src/main/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtils.java +++ b/src/main/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtils.java @@ -390,7 +390,7 @@ public class ExtraFieldUtils { throw new IllegalArgumentException(c + " is not a concrete class"); // NOSONAR } catch (final IllegalAccessException ie) { // NOSONAR throw new IllegalArgumentException(c + "'s no-arg constructor is not public"); // NOSONAR - } catch (ReflectiveOperationException e) { + } catch (final ReflectiveOperationException e) { throw new IllegalArgumentException(c + ": " + e); // NOSONAR } } diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/FileRandomAccessOutputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/FileRandomAccessOutputStream.java index 6ec8ea9ea..2adc0a127 100644 --- a/src/main/java/org/apache/commons/compress/archivers/zip/FileRandomAccessOutputStream.java +++ b/src/main/java/org/apache/commons/compress/archivers/zip/FileRandomAccessOutputStream.java @@ -41,7 +41,7 @@ class FileRandomAccessOutputStream extends RandomAccessOutputStream { this(file, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.WRITE); } - FileRandomAccessOutputStream(final Path file, OpenOption... options) throws IOException { + FileRandomAccessOutputStream(final Path file, final OpenOption... options) throws IOException { this(FileChannel.open(file, options)); } @@ -67,9 +67,9 @@ class FileRandomAccessOutputStream extends RandomAccessOutputStream { @Override public void writeFullyAt(final byte[] b, final int off, final int len, final long atPosition) throws IOException { - ByteBuffer buf = ByteBuffer.wrap(b, off, len); + final ByteBuffer buf = ByteBuffer.wrap(b, off, len); for (long currentPos = atPosition; buf.hasRemaining(); ) { - int written = this.channel.write(buf, currentPos); + final int written = this.channel.write(buf, currentPos); if (written <= 0) { throw new IOException("Failed to fully write to file: written=" + written); } diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/RandomAccessOutputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/RandomAccessOutputStream.java index d0f0aed4c..ae16caf9a 100644 --- a/src/main/java/org/apache/commons/compress/archivers/zip/RandomAccessOutputStream.java +++ b/src/main/java/org/apache/commons/compress/archivers/zip/RandomAccessOutputStream.java @@ -35,7 +35,7 @@ abstract class RandomAccessOutputStream extends OutputStream { @Override public void write(final int b) throws IOException { - write(new byte[]{ (byte) b }); + write(new byte[] { (byte) b }); } /** diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/SeekableChannelRandomAccessOutputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/SeekableChannelRandomAccessOutputStream.java index 473e9b2f5..c58df3618 100644 --- a/src/main/java/org/apache/commons/compress/archivers/zip/SeekableChannelRandomAccessOutputStream.java +++ b/src/main/java/org/apache/commons/compress/archivers/zip/SeekableChannelRandomAccessOutputStream.java @@ -51,7 +51,7 @@ class SeekableChannelRandomAccessOutputStream extends RandomAccessOutputStream { @Override public synchronized void writeFullyAt(final byte[] b, final int off, final int len, final long position) throws IOException { - long saved = channel.position(); + final long saved = channel.position(); try { channel.position(position); ZipIoUtil.writeFully(channel, ByteBuffer.wrap(b, off, len)); diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java index 714ca8bd3..125437d04 100644 --- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java +++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java @@ -295,7 +295,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry implements ArchiveEn this(inputFile.isDirectory() && !entryName.endsWith("/") ? entryName + "/" : entryName); try { setAttributes(inputFile.toPath()); - } catch (IOException e) { // NOSONAR + } catch (final IOException e) { // NOSONAR if (inputFile.isFile()) { setSize(inputFile.length()); } 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 70aaa8979..0def496be 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 @@ -1238,7 +1238,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream<ZipArchiveEntry> * sizes. */ private void rewriteSizesAndCrc(final boolean actuallyNeedsZip64) throws IOException { - RandomAccessOutputStream randomStream = (RandomAccessOutputStream) outputStream; + final RandomAccessOutputStream randomStream = (RandomAccessOutputStream) outputStream; long dataStart = entry.localDataStart; if (randomStream instanceof ZipSplitOutputStream) { dataStart = ((ZipSplitOutputStream) randomStream).calculateDiskPosition(entry.entry.getDiskNumberStart(), dataStart); diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java index dedcf0bfb..a8271e8a3 100644 --- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java +++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java @@ -497,22 +497,22 @@ public class ZipFile implements Closeable { return Files.newByteChannel(path, READ); } - private static SeekableByteChannel openZipChannel(Path path, long maxNumberOfDisks, OpenOption[] openOptions) throws IOException { - FileChannel channel = FileChannel.open(path, StandardOpenOption.READ); - List<FileChannel> channels = new ArrayList<>(); + private static SeekableByteChannel openZipChannel(final Path path, final long maxNumberOfDisks, final OpenOption[] openOptions) throws IOException { + final FileChannel channel = FileChannel.open(path, StandardOpenOption.READ); + final List<FileChannel> channels = new ArrayList<>(); try { - boolean is64 = positionAtEndOfCentralDirectoryRecord(channel); + final boolean is64 = positionAtEndOfCentralDirectoryRecord(channel); long numberOfDisks; if (is64) { channel.position(channel.position() + ZipConstants.WORD + ZipConstants.WORD + ZipConstants.DWORD); - ByteBuffer buf = ByteBuffer.allocate(ZipConstants.WORD); + final ByteBuffer buf = ByteBuffer.allocate(ZipConstants.WORD); buf.order(ByteOrder.LITTLE_ENDIAN); IOUtils.readFully(channel, buf); buf.flip(); numberOfDisks = buf.getInt() & 0xffffffffL; } else { channel.position(channel.position() + ZipConstants.WORD); - ByteBuffer buf = ByteBuffer.allocate(ZipConstants.SHORT); + final ByteBuffer buf = ByteBuffer.allocate(ZipConstants.SHORT); buf.order(ByteOrder.LITTLE_ENDIAN); IOUtils.readFully(channel, buf); buf.flip(); @@ -528,8 +528,8 @@ public class ZipFile implements Closeable { } channel.close(); - Path parent = path.getParent(); - String basename = FilenameUtils.removeExtension(path.getFileName().toString()); + final Path parent = path.getParent(); + final String basename = FilenameUtils.removeExtension(path.getFileName().toString()); return ZipSplitReadOnlySeekableByteChannel.forPaths( IntStream.range(0, (int) numberOfDisks) @@ -537,11 +537,11 @@ public class ZipFile implements Closeable { if (i == numberOfDisks - 1) { return path; } - Path lowercase = parent.resolve(String.format("%s.z%02d", basename, i + 1)); + final Path lowercase = parent.resolve(String.format("%s.z%02d", basename, i + 1)); if (Files.exists(lowercase)) { return lowercase; } - Path uppercase = parent.resolve(String.format("%s.Z%02d", basename, i + 1)); + final Path uppercase = parent.resolve(String.format("%s.Z%02d", basename, i + 1)); if (Files.exists(uppercase)) { return uppercase; } @@ -550,7 +550,7 @@ public class ZipFile implements Closeable { .collect(Collectors.toList()), openOptions ); - } catch (Throwable ex) { + } catch (final Throwable ex) { IOUtils.closeQuietly(channel); channels.forEach(IOUtils::closeQuietly); throw ex; @@ -563,15 +563,15 @@ public class ZipFile implements Closeable { * @return * true if it's Zip64 end of central directory or false if it's Zip32 */ - private static boolean positionAtEndOfCentralDirectoryRecord(SeekableByteChannel channel) throws IOException { + private static boolean positionAtEndOfCentralDirectoryRecord(final SeekableByteChannel channel) throws IOException { final boolean found = tryToLocateSignature(channel, MIN_EOCD_SIZE, MAX_EOCD_SIZE, ZipArchiveOutputStream.EOCD_SIG); if (!found) { throw new ZipException("Archive is not a ZIP archive"); } boolean found64 = false; - long position = channel.position(); + final long position = channel.position(); if (position > ZIP64_EOCDL_LENGTH) { - ByteBuffer wordBuf = ByteBuffer.allocate(4); + final ByteBuffer wordBuf = ByteBuffer.allocate(4); channel.position(channel.position() - ZIP64_EOCDL_LENGTH); wordBuf.rewind(); IOUtils.readFully(channel, wordBuf); @@ -597,7 +597,7 @@ public class ZipFile implements Closeable { final long maxDistanceFromEnd, final byte[] sig ) throws IOException { - ByteBuffer wordBuf = ByteBuffer.allocate(ZipConstants.WORD); + final ByteBuffer wordBuf = ByteBuffer.allocate(ZipConstants.WORD); boolean found = false; long off = channel.size() - minDistanceFromEnd; final long stopSearching = Math.max(0L, channel.size() - maxDistanceFromEnd); @@ -1308,7 +1308,7 @@ public class ZipFile implements Closeable { * stream at the first central directory record. */ private void positionAtCentralDirectory() throws IOException { - boolean is64 = positionAtEndOfCentralDirectoryRecord(archive); + final boolean is64 = positionAtEndOfCentralDirectoryRecord(archive); if (!is64) { positionAtCentralDirectory32(); } else { diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipIoUtil.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipIoUtil.java index bc6840bd0..2de5c1b1f 100644 --- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipIoUtil.java +++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipIoUtil.java @@ -40,10 +40,10 @@ class ZipIoUtil { * @throws IOException * when writing fails or fails to write fully */ - static void writeFully(SeekableByteChannel channel, ByteBuffer buf) throws IOException { + static void writeFully(final SeekableByteChannel channel, final ByteBuffer buf) throws IOException { while (buf.hasRemaining()) { - int remaining = buf.remaining(); - int written = channel.write(buf); + final int remaining = buf.remaining(); + final int written = channel.write(buf); if (written <= 0) { throw new IOException("Failed to fully write: channel=" + channel + " length=" + remaining + " written=" + written); } @@ -62,10 +62,10 @@ class ZipIoUtil { * @throws IOException * when writing fails or fails to write fully */ - static void writeFullyAt(FileChannel channel, ByteBuffer buf, long position) throws IOException { + static void writeFullyAt(final FileChannel channel, final ByteBuffer buf, final long position) throws IOException { for (long currentPosition = position; buf.hasRemaining(); ) { - int remaining = buf.remaining(); - int written = channel.write(buf, currentPosition); + final int remaining = buf.remaining(); + final int written = channel.write(buf, currentPosition); if (written <= 0) { throw new IOException("Failed to fully write: channel=" + channel + " length=" + remaining + " written=" + written); } diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipSplitOutputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipSplitOutputStream.java index a8a7a7938..f6760db90 100644 --- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipSplitOutputStream.java +++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipSplitOutputStream.java @@ -58,9 +58,9 @@ final class ZipSplitOutputStream extends RandomAccessOutputStream { private boolean finished; private final byte[] singleByte = new byte[1]; - private List<Long> diskToPosition = new ArrayList<>(); + private final List<Long> diskToPosition = new ArrayList<>(); - private TreeMap<Long, Path> positionToFiles = new TreeMap<>(); + private final TreeMap<Long, Path> positionToFiles = new TreeMap<>(); /** * Creates a split ZIP. If the ZIP file is smaller than the split size, then there will only be one split ZIP, and its suffix is .zip, otherwise the split @@ -99,7 +99,7 @@ final class ZipSplitOutputStream extends RandomAccessOutputStream { writeZipSplitSignature(); } - public long calculateDiskPosition(long disk, long localOffset) throws IOException { + public long calculateDiskPosition(final long disk, final long localOffset) throws IOException { if (disk >= Integer.MAX_VALUE) { throw new IOException("Disk number exceeded internal limits: limit=" + Integer.MAX_VALUE + " requested=" + disk); } @@ -129,7 +129,7 @@ final class ZipSplitOutputStream extends RandomAccessOutputStream { * @throws IOException */ private Path createNewSplitSegmentFile(final Integer zipSplitSegmentSuffixIndex) throws IOException { - Path newFile = getSplitSegmentFilename(zipSplitSegmentSuffixIndex); + final Path newFile = getSplitSegmentFilename(zipSplitSegmentSuffixIndex); if (Files.exists(newFile)) { throw new IOException("split ZIP segment " + newFile + " already exists"); @@ -275,8 +275,8 @@ final class ZipSplitOutputStream extends RandomAccessOutputStream { public void writeFullyAt(final byte[] b, final int off, final int len, final long atPosition) throws IOException { long remainingPosition = atPosition; for (int remainingOff = off, remainingLen = len; remainingLen > 0; ) { - Map.Entry<Long, Path> segment = positionToFiles.floorEntry(remainingPosition); - Long segmentEnd = positionToFiles.higherKey(remainingPosition); + final Map.Entry<Long, Path> segment = positionToFiles.floorEntry(remainingPosition); + final Long segmentEnd = positionToFiles.higherKey(remainingPosition); if (segmentEnd == null) { ZipIoUtil.writeFullyAt(this.currentChannel, ByteBuffer.wrap(b, remainingOff, remainingLen), remainingPosition - segment.getKey()); remainingPosition += remainingLen; @@ -288,7 +288,7 @@ final class ZipSplitOutputStream extends RandomAccessOutputStream { remainingOff += remainingLen; remainingLen = 0; } else { - int toWrite = Math.toIntExact(segmentEnd - remainingPosition); + final int toWrite = Math.toIntExact(segmentEnd - remainingPosition); writeToSegment(segment.getValue(), remainingPosition - segment.getKey(), b, remainingOff, toWrite); remainingPosition += toWrite; remainingOff += toWrite; diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipSplitReadOnlySeekableByteChannel.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipSplitReadOnlySeekableByteChannel.java index 14913ea7b..1547c55a9 100644 --- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipSplitReadOnlySeekableByteChannel.java +++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipSplitReadOnlySeekableByteChannel.java @@ -203,7 +203,7 @@ public class ZipSplitReadOnlySeekableByteChannel extends MultiReadOnlySeekableBy * @throws IOException if the first channel doesn't seem to hold the beginning of a split archive * @since 1.22 */ - public static SeekableByteChannel forPaths(final List<Path> paths, OpenOption[] openOptions) throws IOException { + public static SeekableByteChannel forPaths(final List<Path> paths, final OpenOption[] openOptions) throws IOException { final List<SeekableByteChannel> channels = new ArrayList<>(); for (final Path path : Objects.requireNonNull(paths, "paths must not be null")) { channels.add(Files.newByteChannel(path, openOptions)); diff --git a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java index dfa0bf641..2d875e1ed 100644 --- a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java +++ b/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java @@ -338,7 +338,7 @@ public class GzipCompressorInputStream extends CompressorInputStream implements in.reset(); final int skipAmount = bufUsed - inf.getRemaining(); - if (org.apache.commons.io.IOUtils.skip(in, (long) skipAmount) != skipAmount) { + if (org.apache.commons.io.IOUtils.skip(in, skipAmount) != skipAmount) { throw new IOException(); } diff --git a/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorOutputStream.java b/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorOutputStream.java index 6f02941f7..ab9ba7925 100644 --- a/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorOutputStream.java +++ b/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorOutputStream.java @@ -270,7 +270,7 @@ public class FramedLZ4CompressorOutputStream extends CompressorOutputStream { } int blockDataRemaining = blockData.length - currentIndex; while (len > 0) { - int copyLen = Math.min(len, blockDataRemaining); + final int copyLen = Math.min(len, blockDataRemaining); System.arraycopy(data, off, blockData, currentIndex, copyLen); off += copyLen; blockDataRemaining -= copyLen; diff --git a/src/main/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStream.java index 5b85e347a..d4bb9e428 100644 --- a/src/main/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStream.java +++ b/src/main/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStream.java @@ -334,7 +334,7 @@ public class FramedSnappyCompressorInputStream extends CompressorInputStream imp if (size < 0) { throw new IOException("Found illegal chunk with negative size"); } - final long read = org.apache.commons.io.IOUtils.skip(inputStream, (long) size); + final long read = org.apache.commons.io.IOUtils.skip(inputStream, size); count(read); if (read != size) { throw new IOException("Premature end of stream"); diff --git a/src/main/java/org/apache/commons/compress/harmony/pack200/NewAttributeBands.java b/src/main/java/org/apache/commons/compress/harmony/pack200/NewAttributeBands.java index 46c06fc8d..00be20c2e 100644 --- a/src/main/java/org/apache/commons/compress/harmony/pack200/NewAttributeBands.java +++ b/src/main/java/org/apache/commons/compress/harmony/pack200/NewAttributeBands.java @@ -297,9 +297,9 @@ public class NewAttributeBands extends BandSet { private final String tag; - private List<ConstantPoolEntry> band = new ArrayList<>(); + private final List<ConstantPoolEntry> band = new ArrayList<>(); - private boolean nullsAllowed; + private final boolean nullsAllowed; public Reference(final String tag) { this.tag = tag; diff --git a/src/main/java/org/apache/commons/compress/utils/IOUtils.java b/src/main/java/org/apache/commons/compress/utils/IOUtils.java index 3751525c0..7983db97f 100644 --- a/src/main/java/org/apache/commons/compress/utils/IOUtils.java +++ b/src/main/java/org/apache/commons/compress/utils/IOUtils.java @@ -286,7 +286,7 @@ public final class IOUtils { * @deprecated Use {@link org.apache.commons.io.IOUtils#skip(InputStream, long)}. */ @Deprecated - public static long skip(final InputStream input, long numToSkip) throws IOException { + public static long skip(final InputStream input, final long numToSkip) throws IOException { return org.apache.commons.io.IOUtils.skip(input, numToSkip); } diff --git a/src/test/java/org/apache/commons/compress/AbstractTest.java b/src/test/java/org/apache/commons/compress/AbstractTest.java index 42af55459..a9bddbd1c 100644 --- a/src/test/java/org/apache/commons/compress/AbstractTest.java +++ b/src/test/java/org/apache/commons/compress/AbstractTest.java @@ -64,7 +64,7 @@ public abstract class AbstractTest extends AbstractTempDirTest { FileUtils.forceDelete(file); } return true; - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); file.deleteOnExit(); return false; @@ -88,7 +88,7 @@ public abstract class AbstractTest extends AbstractTempDirTest { } try { return new File(url.toURI()); - } catch (URISyntaxException ex) { + } catch (final URISyntaxException ex) { throw new IOException(ex); } } diff --git a/src/test/java/org/apache/commons/compress/ArchiveReadTest.java b/src/test/java/org/apache/commons/compress/ArchiveReadTest.java index 25baad55e..cf0042003 100644 --- a/src/test/java/org/apache/commons/compress/ArchiveReadTest.java +++ b/src/test/java/org/apache/commons/compress/ArchiveReadTest.java @@ -50,7 +50,7 @@ public class ArchiveReadTest extends AbstractTest { static { try { ARCDIR = new File(CLASSLOADER.getResource("archives").toURI()); - } catch (URISyntaxException e) { + } catch (final URISyntaxException e) { throw new AssertionError(e); } } diff --git a/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java b/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java index 821bfc5f9..d38c9604f 100644 --- a/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java @@ -101,7 +101,7 @@ public class ArchiveStreamFactoryTest extends AbstractTest { dflt = UNKNOWN; try (ArjArchiveInputStream inputStream = new ArjArchiveInputStream(newInputStream("bla.arj"))) { dflt = getField(inputStream, "charsetName"); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } ARJ_DEFAULT = dflt; @@ -109,7 +109,7 @@ public class ArchiveStreamFactoryTest extends AbstractTest { try (DumpArchiveInputStream inputStream = new DumpArchiveInputStream(newInputStream("bla.dump"))) { dflt = getField(inputStream, "encoding"); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } DUMP_DEFAULT = dflt; @@ -171,10 +171,10 @@ public class ArchiveStreamFactoryTest extends AbstractTest { Field fld; try { fld = cls.getDeclaredField(name); - } catch (NoSuchFieldException nsfe) { + } catch (final NoSuchFieldException nsfe) { try { fld = cls.getSuperclass().getDeclaredField(name); - } catch (NoSuchFieldException e) { + } catch (final NoSuchFieldException e) { System.out.println("Cannot find " + name + " in class " + instance.getClass().getSimpleName()); return UNKNOWN; } @@ -190,7 +190,7 @@ public class ArchiveStreamFactoryTest extends AbstractTest { } System.out.println("Wrong type: " + object.getClass().getCanonicalName() + " for " + name + " in class " + instance.getClass().getSimpleName()); return UNKNOWN; - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); return UNKNOWN; } finally { diff --git a/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java b/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java index 38201b788..39eac81dd 100644 --- a/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java @@ -55,7 +55,7 @@ public class LongPathTest extends AbstractTest { static { try { ARCDIR = new File(CLASSLOADER.getResource("longpath").toURI()); - } catch (URISyntaxException e) { + } catch (final URISyntaxException e) { throw new AssertionError(e); } } diff --git a/src/test/java/org/apache/commons/compress/archivers/LongSymLinkTest.java b/src/test/java/org/apache/commons/compress/archivers/LongSymLinkTest.java index 1a95a2eda..1ae22f1ed 100644 --- a/src/test/java/org/apache/commons/compress/archivers/LongSymLinkTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/LongSymLinkTest.java @@ -54,7 +54,7 @@ public class LongSymLinkTest extends AbstractTest { static { try { ARCDIR = new File(CLASSLOADER.getResource("longsymlink").toURI()); - } catch (URISyntaxException e) { + } catch (final URISyntaxException e) { throw new AssertionError(e); } } diff --git a/src/test/java/org/apache/commons/compress/archivers/TarTest.java b/src/test/java/org/apache/commons/compress/archivers/TarTest.java index 0bf52ee2c..f97370358 100644 --- a/src/test/java/org/apache/commons/compress/archivers/TarTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/TarTest.java @@ -293,7 +293,7 @@ public final class TarTest extends AbstractTest { os2.putArchiveEntry(entry); Files.copy(file1.toPath(), os2); os2.closeArchiveEntry(); - } catch (IOException e) { + } catch (final IOException e) { assertTrue(true); } } diff --git a/src/test/java/org/apache/commons/compress/archivers/ZipTest.java b/src/test/java/org/apache/commons/compress/archivers/ZipTest.java index 76c145c47..1aab3e5eb 100644 --- a/src/test/java/org/apache/commons/compress/archivers/ZipTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/ZipTest.java @@ -144,10 +144,10 @@ public final class ZipTest extends AbstractTest { zos.closeArchiveEntry(); } - private byte[] createArtificialData(int size) { + private byte[] createArtificialData(final int size) { final ByteArrayOutputStream output = new ByteArrayOutputStream(); for (int i = 0; i < size; i += 1) { - output.write((byte) ((i & 1) == 0 ? (i / 2 % 256) : (i / 2 / 256))); + output.write((byte) ((i & 1) == 0 ? i / 2 % 256 : i / 2 / 256)); } return output.toByteArray(); } @@ -242,12 +242,12 @@ public final class ZipTest extends AbstractTest { final long splitSize = 64 * 1024L; /* 64 KB */ try (ZipArchiveOutputStream zipArchiveOutputStream = new ZipArchiveOutputStream(outputZipFile, splitSize)) { zipArchiveOutputStream.setUseZip64(Zip64Mode.Never); - ZipArchiveEntry ze1 = new ZipArchiveEntry("file01"); + final ZipArchiveEntry ze1 = new ZipArchiveEntry("file01"); ze1.setMethod(ZipEntry.STORED); zipArchiveOutputStream.putArchiveEntry(ze1); zipArchiveOutputStream.write(createArtificialData(65536)); zipArchiveOutputStream.closeArchiveEntry(); - ZipArchiveEntry ze2 = new ZipArchiveEntry("file02"); + final ZipArchiveEntry ze2 = new ZipArchiveEntry("file02"); ze2.setMethod(ZipEntry.DEFLATED); zipArchiveOutputStream.putArchiveEntry(ze2); zipArchiveOutputStream.write(createArtificialData(65536)); @@ -271,15 +271,15 @@ public final class ZipTest extends AbstractTest { public void testBuildArtificialSplitZip64Test() throws IOException { final File outputZipFile = newTempFile("artificialSplitZip.zip"); final long splitSize = 64 * 1024L; /* 64 KB */ - byte[] data = createArtificialData(128 * 1024); + final byte[] data = createArtificialData(128 * 1024); try (ZipArchiveOutputStream zipArchiveOutputStream = new ZipArchiveOutputStream(outputZipFile, splitSize)) { zipArchiveOutputStream.setUseZip64(Zip64Mode.Always); - ZipArchiveEntry ze1 = new ZipArchiveEntry("file01"); + final ZipArchiveEntry ze1 = new ZipArchiveEntry("file01"); ze1.setMethod(ZipEntry.STORED); zipArchiveOutputStream.putArchiveEntry(ze1); zipArchiveOutputStream.write(data); zipArchiveOutputStream.closeArchiveEntry(); - ZipArchiveEntry ze2 = new ZipArchiveEntry("file02"); + final ZipArchiveEntry ze2 = new ZipArchiveEntry("file02"); ze2.setMethod(ZipEntry.DEFLATED); zipArchiveOutputStream.putArchiveEntry(ze2); zipArchiveOutputStream.write(data); @@ -306,10 +306,10 @@ public final class ZipTest extends AbstractTest { // 4 is PK signature, 36 is size of header + local file header, // 36 is length of central directory entry // 1 is remaining byte in first archive, this should be skipped - byte[] data1 = createArtificialData(64 * 1024 - 4 - 36 - 52 - 1); + final byte[] data1 = createArtificialData(64 * 1024 - 4 - 36 - 52 - 1); try (ZipArchiveOutputStream zipArchiveOutputStream = new ZipArchiveOutputStream(outputZipFile, splitSize)) { zipArchiveOutputStream.setUseZip64(Zip64Mode.Never); - ZipArchiveEntry ze1 = new ZipArchiveEntry("file01"); + final ZipArchiveEntry ze1 = new ZipArchiveEntry("file01"); ze1.setMethod(ZipEntry.STORED); zipArchiveOutputStream.putArchiveEntry(ze1); zipArchiveOutputStream.write(data1); @@ -336,34 +336,34 @@ public final class ZipTest extends AbstractTest { final long splitSize = 64 * 1024L; /* 64 KB */ // 4 is PK signature, 36 is size of header + local file header, // 15 is next local file header up to second byte of CRC - byte[] data1 = createArtificialData(64 * 1024 - 4 - 36 - 15); + final byte[] data1 = createArtificialData(64 * 1024 - 4 - 36 - 15); // 21 is remaining size of second local file header // 19 is next local file header up to second byte of compressed size - byte[] data2 = createArtificialData(64 * 1024 - 21 - 19); + final byte[] data2 = createArtificialData(64 * 1024 - 21 - 19); // 17 is remaining size of third local file header // 23 is next local file header up to second byte of uncompressed size - byte[] data3 = createArtificialData(64 * 1024 - 17 - 23); + final byte[] data3 = createArtificialData(64 * 1024 - 17 - 23); // 13 is remaining size of third local file header // 1 is to wrap to next part - byte[] data4 = createArtificialData(64 * 1024 - 13 + 1); + final byte[] data4 = createArtificialData(64 * 1024 - 13 + 1); try (ZipArchiveOutputStream zipArchiveOutputStream = new ZipArchiveOutputStream(outputZipFile, splitSize)) { zipArchiveOutputStream.setUseZip64(Zip64Mode.Never); - ZipArchiveEntry ze1 = new ZipArchiveEntry("file01"); + final ZipArchiveEntry ze1 = new ZipArchiveEntry("file01"); ze1.setMethod(ZipEntry.STORED); zipArchiveOutputStream.putArchiveEntry(ze1); zipArchiveOutputStream.write(data1); zipArchiveOutputStream.closeArchiveEntry(); - ZipArchiveEntry ze2 = new ZipArchiveEntry("file02"); + final ZipArchiveEntry ze2 = new ZipArchiveEntry("file02"); ze2.setMethod(ZipEntry.STORED); zipArchiveOutputStream.putArchiveEntry(ze2); zipArchiveOutputStream.write(data2); zipArchiveOutputStream.closeArchiveEntry(); - ZipArchiveEntry ze3 = new ZipArchiveEntry("file03"); + final ZipArchiveEntry ze3 = new ZipArchiveEntry("file03"); ze3.setMethod(ZipEntry.STORED); zipArchiveOutputStream.putArchiveEntry(ze3); zipArchiveOutputStream.write(data3); zipArchiveOutputStream.closeArchiveEntry(); - ZipArchiveEntry ze4 = new ZipArchiveEntry("file04"); + final ZipArchiveEntry ze4 = new ZipArchiveEntry("file04"); ze4.setMethod(ZipEntry.STORED); zipArchiveOutputStream.putArchiveEntry(ze4); zipArchiveOutputStream.write(data4); @@ -420,7 +420,7 @@ public final class ZipTest extends AbstractTest { sameNameFile.createNewFile(); assertThrows(IOException.class, () -> addFilesToZip(zipArchiveOutputStream, directoryToZip)); - } catch (Exception e) { + } catch (final Exception e) { // Ignore: // java.io.IOException: This archive contains unclosed entries. // at org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.finish(ZipArchiveOutputStream.java:563) @@ -701,7 +701,7 @@ public final class ZipTest extends AbstractTest { while ((nestedEntry = nestedIn.getNextEntry()) != null) { results.add(nestedEntry.getName()); } - } catch (ZipException ex) { + } catch (final ZipException ex) { // expected since you cannot create a final ArchiveInputStream from test3.xml expectedExceptions.add(ex); } diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveEntryTest.java b/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveEntryTest.java index ec04eb0b7..130125dc7 100644 --- a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveEntryTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveEntryTest.java @@ -272,8 +272,8 @@ public class TarArchiveEntryTest implements TarConstants { // @formatter:on final TarArchiveEntry entry = new TarArchiveEntry("test.txt"); - for (String name : headerNames) { - for (String value : testValues) { + for (final String name : headerNames) { + for (final String value : testValues) { final Exception exp = assertThrows(IllegalArgumentException.class, () -> entry.addPaxHeader(name, value)); assert exp.getCause().getMessage().startsWith("Corrupted PAX header. Time field value is invalid"); } diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java index 884d6e060..a7a094774 100644 --- a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java @@ -82,7 +82,7 @@ public class TarArchiveInputStreamTest extends AbstractTest { while (entry != null) { entry = tar.getNextTarEntry(); } - } catch (IOException e) { + } catch (final IOException e) { fail("COMPRESS-197: " + e.getMessage()); } } @@ -259,7 +259,7 @@ public class TarArchiveInputStreamTest extends AbstractTest { } assertEquals(31, count); } - } catch (IOException e) { + } catch (final IOException e) { fail("COMPRESS-245: " + e.getMessage()); } } diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/TarFileTest.java b/src/test/java/org/apache/commons/compress/archivers/tar/TarFileTest.java index f66ee180e..92b1b61dd 100644 --- a/src/test/java/org/apache/commons/compress/archivers/tar/TarFileTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/tar/TarFileTest.java @@ -222,7 +222,7 @@ public class TarFileTest extends AbstractTest { try (TarFile tarFile = new TarFile(tempTar)) { assertEquals(31, tarFile.getEntries().size()); } - } catch (IOException e) { + } catch (final IOException e) { fail("COMPRESS-245: " + e.getMessage()); } } diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/FileRandomAccessOutputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/FileRandomAccessOutputStreamTest.java index e23dbf05b..f00efb927 100644 --- a/src/test/java/org/apache/commons/compress/archivers/zip/FileRandomAccessOutputStreamTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/zip/FileRandomAccessOutputStreamTest.java @@ -39,7 +39,7 @@ import org.junit.jupiter.api.Test; public class FileRandomAccessOutputStreamTest extends AbstractTempDirTest { @Test public void testChannelReturn() throws IOException { - Path file = newTempPath("testChannel"); + final Path file = newTempPath("testChannel"); try (FileRandomAccessOutputStream stream = new FileRandomAccessOutputStream(file)) { assertNotNull(stream.channel()); } @@ -47,8 +47,8 @@ public class FileRandomAccessOutputStreamTest extends AbstractTempDirTest { @Test public void testWrite() throws IOException { - FileChannel channel = mock(FileChannel.class); - FileRandomAccessOutputStream stream = new FileRandomAccessOutputStream(channel); + final FileChannel channel = mock(FileChannel.class); + final FileRandomAccessOutputStream stream = new FileRandomAccessOutputStream(channel); when(channel.write((ByteBuffer) any())) .thenAnswer(answer -> { ((ByteBuffer) answer.getArgument(0)).position(5); @@ -68,8 +68,8 @@ public class FileRandomAccessOutputStreamTest extends AbstractTempDirTest { @Test public void testWriteFullyAt_whenFullAtOnce_thenSucceed() throws IOException { - FileChannel channel = mock(FileChannel.class); - FileRandomAccessOutputStream stream = new FileRandomAccessOutputStream(channel); + final FileChannel channel = mock(FileChannel.class); + final FileRandomAccessOutputStream stream = new FileRandomAccessOutputStream(channel); when(channel.write((ByteBuffer) any(), eq(20L))) .thenAnswer(answer -> { ((ByteBuffer) answer.getArgument(0)).position(5); @@ -93,8 +93,8 @@ public class FileRandomAccessOutputStreamTest extends AbstractTempDirTest { @Test public void testWriteFullyAt_whenFullButPartial_thenSucceed() throws IOException { - FileChannel channel = mock(FileChannel.class); - FileRandomAccessOutputStream stream = new FileRandomAccessOutputStream(channel); + final FileChannel channel = mock(FileChannel.class); + final FileRandomAccessOutputStream stream = new FileRandomAccessOutputStream(channel); when(channel.write((ByteBuffer) any(), eq(20L))) .thenAnswer(answer -> { ((ByteBuffer) answer.getArgument(0)).position(3); @@ -125,17 +125,15 @@ public class FileRandomAccessOutputStreamTest extends AbstractTempDirTest { @Test public void testWriteFullyAt_whenPartial_thenFail() throws IOException { - FileChannel channel = mock(FileChannel.class); - FileRandomAccessOutputStream stream = new FileRandomAccessOutputStream(channel); + final FileChannel channel = mock(FileChannel.class); + final FileRandomAccessOutputStream stream = new FileRandomAccessOutputStream(channel); when(channel.write((ByteBuffer) any(), eq(20L))) .thenAnswer(answer -> { ((ByteBuffer) answer.getArgument(0)).position(3); return 3; }); when(channel.write((ByteBuffer) any(), eq(23L))) - .thenAnswer(answer -> { - return 0; - }); + .thenAnswer(answer -> 0); assertThrows(IOException.class, () -> stream.writeFullyAt("hello".getBytes(StandardCharsets.UTF_8), 20)); verify(channel, times(1)) diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java index 69fec3b27..5fff9817f 100644 --- a/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreatorTest.java @@ -175,31 +175,31 @@ public class ParallelScatterZipCreatorTest extends AbstractTempDirTest { @Test public void testCallableApiUsingSubmit() throws Exception { - File result = createTempFile("parallelScatterGather2", ""); + final File result = createTempFile("parallelScatterGather2", ""); callableApi(zipCreator -> zipCreator::submit, result); } @Test public void testCallableApiUsingSubmitStreamAwareCallable() throws Exception { - File result = createTempFile("parallelScatterGather3", ""); + final File result = createTempFile("parallelScatterGather3", ""); callableApi(zipCreator -> zipCreator::submitStreamAwareCallable, result); } @Test public void testCallableApiWithHighestLevelUsingSubmitStreamAwareCallable() throws Exception { - File result = createTempFile("parallelScatterGather5", ""); + final File result = createTempFile("parallelScatterGather5", ""); callableApiWithTestFiles(zipCreator -> zipCreator::submitStreamAwareCallable, Deflater.BEST_COMPRESSION, result); } @Test public void testCallableWithLowestLevelApiUsingSubmit() throws Exception { - File result = createTempFile("parallelScatterGather4", ""); + final File result = createTempFile("parallelScatterGather4", ""); callableApiWithTestFiles(zipCreator -> zipCreator::submit, Deflater.NO_COMPRESSION, result); } @Test public void testConcurrentCustomTempFolder() throws Exception { - File result = createTempFile("parallelScatterGather1", ""); + final File result = createTempFile("parallelScatterGather1", ""); final ParallelScatterZipCreator zipCreator; final Map<String, byte[]> entries; try (ZipArchiveOutputStream zos = new ZipArchiveOutputStream(result)) { @@ -222,7 +222,7 @@ public class ParallelScatterZipCreatorTest extends AbstractTempDirTest { @Test public void testConcurrentDefaultTempFolder() throws Exception { - File result = createTempFile("parallelScatterGather1", ""); + final File result = createTempFile("parallelScatterGather1", ""); final ParallelScatterZipCreator zipCreator; final Map<String, byte[]> entries; try (ZipArchiveOutputStream zos = new ZipArchiveOutputStream(result)) { @@ -324,7 +324,7 @@ public class ParallelScatterZipCreatorTest extends AbstractTempDirTest { final InputStreamSupplier iss = () -> { try { return Files.newInputStream(file.toPath()); - } catch (IOException e) { + } catch (final IOException e) { return null; } }; diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/RandomAccessOutputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/RandomAccessOutputStreamTest.java index d6ccc62ab..59d048249 100644 --- a/src/test/java/org/apache/commons/compress/archivers/zip/RandomAccessOutputStreamTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/zip/RandomAccessOutputStreamTest.java @@ -32,21 +32,21 @@ public class RandomAccessOutputStreamTest extends AbstractTempDirTest { @Test public void testWrite() throws IOException { - RandomAccessOutputStream delegate = mock(RandomAccessOutputStream.class); + final RandomAccessOutputStream delegate = mock(RandomAccessOutputStream.class); - RandomAccessOutputStream stream = new RandomAccessOutputStream() { + final RandomAccessOutputStream stream = new RandomAccessOutputStream() { @Override public long position() throws IOException { return delegate.position(); } @Override - public void write(byte[] b, int off, int len) throws IOException { + public void write(final byte[] b, final int off, final int len) throws IOException { delegate.write(b, off, len); } @Override - void writeFullyAt(byte[] b, int off, int len, long position) throws IOException { + void writeFullyAt(final byte[] b, final int off, final int len, final long position) throws IOException { delegate.writeFullyAt(b, off, len, position); } }; diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/SeekableChannelRandomAccessOutputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/SeekableChannelRandomAccessOutputStreamTest.java index 2ea7ee6c4..cd95d1c1d 100644 --- a/src/test/java/org/apache/commons/compress/archivers/zip/SeekableChannelRandomAccessOutputStreamTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/zip/SeekableChannelRandomAccessOutputStreamTest.java @@ -42,7 +42,7 @@ public class SeekableChannelRandomAccessOutputStreamTest extends AbstractTempDir @Test public void testInitialization() throws IOException { - Path file = newTempPath("testChannel"); + final Path file = newTempPath("testChannel"); try (SeekableChannelRandomAccessOutputStream stream = new SeekableChannelRandomAccessOutputStream( Files.newByteChannel(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE) )) { @@ -52,8 +52,8 @@ public class SeekableChannelRandomAccessOutputStreamTest extends AbstractTempDir @Test public void testWrite() throws IOException { - FileChannel channel = mock(FileChannel.class); - SeekableChannelRandomAccessOutputStream stream = new SeekableChannelRandomAccessOutputStream(channel); + final FileChannel channel = mock(FileChannel.class); + final SeekableChannelRandomAccessOutputStream stream = new SeekableChannelRandomAccessOutputStream(channel); when(channel.position()) .thenReturn(11L); @@ -78,8 +78,8 @@ public class SeekableChannelRandomAccessOutputStreamTest extends AbstractTempDir @Test public void testWriteFullyAt_whenFullAtOnce_thenSucceed() throws IOException { - SeekableByteChannel channel = mock(SeekableByteChannel.class); - SeekableChannelRandomAccessOutputStream stream = new SeekableChannelRandomAccessOutputStream(channel); + final SeekableByteChannel channel = mock(SeekableByteChannel.class); + final SeekableChannelRandomAccessOutputStream stream = new SeekableChannelRandomAccessOutputStream(channel); when(channel.position()) .thenReturn(50L) @@ -109,8 +109,8 @@ public class SeekableChannelRandomAccessOutputStreamTest extends AbstractTempDir @Test public void testWriteFullyAt_whenFullButPartial_thenSucceed() throws IOException { - SeekableByteChannel channel = mock(SeekableByteChannel.class); - SeekableChannelRandomAccessOutputStream stream = new SeekableChannelRandomAccessOutputStream(channel); + final SeekableByteChannel channel = mock(SeekableByteChannel.class); + final SeekableChannelRandomAccessOutputStream stream = new SeekableChannelRandomAccessOutputStream(channel); when(channel.position()) .thenReturn(50L) @@ -144,8 +144,8 @@ public class SeekableChannelRandomAccessOutputStreamTest extends AbstractTempDir @Test public void testWriteFullyAt_whenPartial_thenFail() throws IOException { - SeekableByteChannel channel = mock(SeekableByteChannel.class); - SeekableChannelRandomAccessOutputStream stream = new SeekableChannelRandomAccessOutputStream(channel); + final SeekableByteChannel channel = mock(SeekableByteChannel.class); + final SeekableChannelRandomAccessOutputStream stream = new SeekableChannelRandomAccessOutputStream(channel); when(channel.position()) .thenReturn(50L); @@ -154,9 +154,7 @@ public class SeekableChannelRandomAccessOutputStreamTest extends AbstractTempDir ((ByteBuffer) answer.getArgument(0)).position(3); return 3; }) - .thenAnswer(answer -> { - return 0; - }); + .thenAnswer(answer -> 0); assertThrows(IOException.class, () -> stream.writeFullyAt("hello".getBytes(StandardCharsets.UTF_8), 20)); diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestampTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestampTest.java index 3db1320f0..f08bb9a37 100644 --- a/src/test/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestampTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestampTest.java @@ -495,7 +495,7 @@ public class X5455_ExtendedTimestampTest { int year; try { year = Integer.parseInt(yearString); - } catch (NumberFormatException nfe) { + } catch (final NumberFormatException nfe) { // setTime.sh, skip continue; } diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java b/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java index 6885a15f7..795d4eb22 100644 --- a/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java +++ b/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java @@ -206,7 +206,7 @@ public class Zip64SupportIT { private static void read5GBOfZerosUsingZipFileImpl(final File f, final String expectedName) throws IOException { ZipFile zf = null; try { - zf = ZipFile.builder().setFile(f).get();; + zf = ZipFile.builder().setFile(f).get(); final Enumeration<ZipArchiveEntry> e = zf.getEntries(); assertTrue(e.hasMoreElements()); ZipArchiveEntry zae = e.nextElement(); @@ -260,7 +260,7 @@ public class Zip64SupportIT { try { test.test(f, zos); - } catch (IOException ex) { + } catch (final IOException ex) { System.err.println("Failed to write archive because of: " + ex.getMessage() + " - likely not enough disk space."); assumeTrue(false); } finally { @@ -523,7 +523,7 @@ public class Zip64SupportIT { } zos.closeArchiveEntry(); zos.close(); - } catch (IOException ex) { + } catch (final IOException ex) { System.err.println("Failed to write archive because of: " + ex.getMessage() + " - likely not enough disk space."); assumeTrue(false); } finally { @@ -1892,7 +1892,7 @@ public class Zip64SupportIT { write3EntriesCreatingBigArchiveToStream(zos); ZipFile zf = null; try { - zf = ZipFile.builder().setFile(f).get();; + zf = ZipFile.builder().setFile(f).get(); int idx = 0; for (final Enumeration<ZipArchiveEntry> e = zf.getEntriesInPhysicalOrder(); e.hasMoreElements();) { final ZipArchiveEntry zae = e.nextElement(); diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStreamTest.java index 245611d85..a40acba2d 100644 --- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStreamTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStreamTest.java @@ -720,7 +720,7 @@ public class ZipArchiveInputStreamTest extends AbstractTest { while (zae != null) { zae = zIn.getNextEntry(); } - } catch (IOException e) { + } catch (final IOException e) { // Ignore expected exception } } diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java index 7d2c1ad14..2b7d1fa20 100644 --- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java @@ -18,7 +18,6 @@ package org.apache.commons.compress.archivers.zip; import static java.nio.charset.StandardCharsets.UTF_8; -import static org.apache.commons.compress.AbstractTest.getFile; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ZipIoUtilTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ZipIoUtilTest.java index 7e1eb3d45..9b8e90d07 100644 --- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipIoUtilTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipIoUtilTest.java @@ -38,7 +38,7 @@ public class ZipIoUtilTest extends AbstractTempDirTest { @Test public void testWriteFully_whenFullAtOnce_thenSucceed() throws IOException { - SeekableByteChannel channel = mock(SeekableByteChannel.class); + final SeekableByteChannel channel = mock(SeekableByteChannel.class); when(channel.write((ByteBuffer) any())) .thenAnswer(answer -> { @@ -59,7 +59,7 @@ public class ZipIoUtilTest extends AbstractTempDirTest { @Test public void testWriteFully_whenFullButPartial_thenSucceed() throws IOException { - SeekableByteChannel channel = mock(SeekableByteChannel.class); + final SeekableByteChannel channel = mock(SeekableByteChannel.class); when(channel.write((ByteBuffer) any())) .thenAnswer(answer -> { @@ -84,16 +84,14 @@ public class ZipIoUtilTest extends AbstractTempDirTest { @Test public void testWriteFully_whenPartial_thenFail() throws IOException { - SeekableByteChannel channel = mock(SeekableByteChannel.class); + final SeekableByteChannel channel = mock(SeekableByteChannel.class); when(channel.write((ByteBuffer) any())) .thenAnswer(answer -> { ((ByteBuffer) answer.getArgument(0)).position(3); return 3; }) - .thenAnswer(answer -> { - return 0; - }); + .thenAnswer(answer -> 0); assertThrows(IOException.class, () -> ZipIoUtil.writeFully(channel, ByteBuffer.wrap("hello".getBytes(StandardCharsets.UTF_8))) @@ -105,7 +103,7 @@ public class ZipIoUtilTest extends AbstractTempDirTest { @Test public void testWriteFullyAt_whenFullAtOnce_thenSucceed() throws IOException { - FileChannel channel = mock(FileChannel.class); + final FileChannel channel = mock(FileChannel.class); when(channel.write((ByteBuffer) any(), eq(20L))) .thenAnswer(answer -> { @@ -129,7 +127,7 @@ public class ZipIoUtilTest extends AbstractTempDirTest { @Test public void testWriteFullyAt_whenFullButPartial_thenSucceed() throws IOException { - FileChannel channel = mock(FileChannel.class); + final FileChannel channel = mock(FileChannel.class); when(channel.write((ByteBuffer) any(), eq(20L))) .thenAnswer(answer -> { @@ -160,7 +158,7 @@ public class ZipIoUtilTest extends AbstractTempDirTest { @Test public void testWriteFullyAt_whenPartial_thenFail() throws IOException { - FileChannel channel = mock(FileChannel.class); + final FileChannel channel = mock(FileChannel.class); when(channel.write((ByteBuffer) any(), eq(20L))) .thenAnswer(answer -> { @@ -168,9 +166,7 @@ public class ZipIoUtilTest extends AbstractTempDirTest { return 3; }); when(channel.write((ByteBuffer) any(), eq(23L))) - .thenAnswer(answer -> { - return 0; - }); + .thenAnswer(answer -> 0); assertThrows(IOException.class, () -> ZipIoUtil.writeFullyAt(channel, ByteBuffer.wrap("hello".getBytes(StandardCharsets.UTF_8)), 20)); diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ZipMemoryFileSystemTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ZipMemoryFileSystemTest.java index afe92df24..83c4b0544 100644 --- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipMemoryFileSystemTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipMemoryFileSystemTest.java @@ -83,7 +83,7 @@ public class ZipMemoryFileSystemTest { walk.sorted(Comparator.reverseOrder()).peek(path -> println("Deleting: " + path.toAbsolutePath())).forEach(path -> { try { Files.deleteIfExists(path); - } catch (IOException ignore) { + } catch (final IOException ignore) { } }); } diff --git a/src/test/java/org/apache/commons/compress/compressors/DetectCompressorTest.java b/src/test/java/org/apache/commons/compress/compressors/DetectCompressorTest.java index 4fa8c2ea0..3fae47b8f 100644 --- a/src/test/java/org/apache/commons/compress/compressors/DetectCompressorTest.java +++ b/src/test/java/org/apache/commons/compress/compressors/DetectCompressorTest.java @@ -144,7 +144,7 @@ public final class DetectCompressorTest { final InputStream is = new BufferedInputStream(Files.newInputStream(getFile(fileName).toPath())); try { return fac.createCompressorInputStream(is); - } catch (CompressorException e) { + } catch (final CompressorException e) { if (e.getCause() != null && e.getCause() instanceof Exception) { // unwrap cause to reveal MemoryLimitException throw (Exception) e.getCause(); diff --git a/src/test/java/org/apache/commons/compress/harmony/pack200/tests/ArchiveTest.java b/src/test/java/org/apache/commons/compress/harmony/pack200/tests/ArchiveTest.java index 2c0fa4fb7..9a615fab1 100755 --- a/src/test/java/org/apache/commons/compress/harmony/pack200/tests/ArchiveTest.java +++ b/src/test/java/org/apache/commons/compress/harmony/pack200/tests/ArchiveTest.java @@ -201,7 +201,7 @@ public class ArchiveTest extends AbstractTempDirTest { public void testJNDI() throws IOException, Pack200Exception, URISyntaxException { final File file = createTempFile("jndi", ".pack"); try (JarFile in = new JarFile(new File(Archive.class.getResource("/pack200/jndi.jar").toURI()))) { - FileOutputStream out = new FileOutputStream(file); + final FileOutputStream out = new FileOutputStream(file); final PackingOptions options = new PackingOptions(); options.setGzip(false); new Archive(in, out, options).pack(); @@ -249,7 +249,7 @@ public class ArchiveTest extends AbstractTempDirTest { @ParameterizedTest @MethodSource("loadMultipleJars") public void testMultipleJars(final Path path) throws IOException, Pack200Exception { - File file = createTempFile("temp", ".pack.gz"); + final File file = createTempFile("temp", ".pack.gz"); final File inputFile = path.toFile(); try (JarFile in = new JarFile(inputFile); FileOutputStream out = new FileOutputStream(file)) { diff --git a/src/test/java/org/apache/commons/compress/harmony/pack200/tests/BHSDCodecTest.java b/src/test/java/org/apache/commons/compress/harmony/pack200/tests/BHSDCodecTest.java index 415abea43..2b650d0cd 100644 --- a/src/test/java/org/apache/commons/compress/harmony/pack200/tests/BHSDCodecTest.java +++ b/src/test/java/org/apache/commons/compress/harmony/pack200/tests/BHSDCodecTest.java @@ -76,7 +76,7 @@ public class BHSDCodecTest { long decoded = 0; try { decoded = codec.decode(new ByteArrayInputStream(encoded), 0); - } catch (EOFException e) { + } catch (final EOFException e) { System.out.println(e); } if (j != decoded) { diff --git a/src/test/java/org/apache/commons/compress/harmony/pack200/tests/PackingOptionsTest.java b/src/test/java/org/apache/commons/compress/harmony/pack200/tests/PackingOptionsTest.java index b8696c5e4..3cb5c4e42 100644 --- a/src/test/java/org/apache/commons/compress/harmony/pack200/tests/PackingOptionsTest.java +++ b/src/test/java/org/apache/commons/compress/harmony/pack200/tests/PackingOptionsTest.java @@ -109,7 +109,7 @@ public class PackingOptionsTest extends AbstractTempDirTest { @Test public void testErrorAttributes() throws Exception { - File file = createTempFile("unknown", ".pack"); + final File file = createTempFile("unknown", ".pack"); try (JarFile in = new JarFile(new File(Archive.class.getResource("/pack200/jndiWithUnknownAttributes.jar").toURI())); FileOutputStream out = new FileOutputStream(file)) { final PackingOptions options = new PackingOptions(); @@ -321,7 +321,7 @@ public class PackingOptionsTest extends AbstractTempDirTest { @Test public void testNewAttributes() throws Exception { - File file = createTempFile("unknown", ".pack"); + final File file = createTempFile("unknown", ".pack"); try (FileOutputStream out = new FileOutputStream(file); JarFile in = new JarFile(new File(Archive.class.getResource("/pack200/jndiWithUnknownAttributes.jar").toURI()))) { final PackingOptions options = new PackingOptions(); @@ -344,7 +344,7 @@ public class PackingOptionsTest extends AbstractTempDirTest { @Test public void testNewAttributes2() throws Exception { - File file = createTempFile("unknown", ".pack"); + final File file = createTempFile("unknown", ".pack"); try (FileOutputStream out = new FileOutputStream(file); JarFile in = new JarFile(new File(Archive.class.getResource("/pack200/p200WithUnknownAttributes.jar").toURI()))) { final PackingOptions options = new PackingOptions(); @@ -370,7 +370,7 @@ public class PackingOptionsTest extends AbstractTempDirTest { @Test public void testPackEffort0() throws Pack200Exception, IOException, URISyntaxException { final File f1 = new File(Archive.class.getResource("/pack200/jndi.jar").toURI()); - File file = createTempFile("jndiE0", ".pack"); + final File file = createTempFile("jndiE0", ".pack"); try (JarFile in = new JarFile(f1); FileOutputStream out = new FileOutputStream(file)) { final PackingOptions options = new PackingOptions(); @@ -386,7 +386,7 @@ public class PackingOptionsTest extends AbstractTempDirTest { @Test public void testPassAttributes() throws Exception { - File file = createTempFile("unknown", ".pack"); + final File file = createTempFile("unknown", ".pack"); try (FileOutputStream out = new FileOutputStream(file); JarFile in = new JarFile(new File(Archive.class.getResource("/pack200/jndiWithUnknownAttributes.jar").toURI()))) { final PackingOptions options = new PackingOptions(); @@ -419,7 +419,7 @@ public class PackingOptionsTest extends AbstractTempDirTest { } // Pass one file - File file = createTempFile("sql", ".pack"); + final File file = createTempFile("sql", ".pack"); try (JarFile in = new JarFile(new File(Archive.class.getResource("/pack200/sqlUnpacked.jar").toURI())); FileOutputStream out = new FileOutputStream(file)) { final PackingOptions options = new PackingOptions(); @@ -494,7 +494,7 @@ public class PackingOptionsTest extends AbstractTempDirTest { @Test public void testStripDebug() throws IOException, Pack200Exception, URISyntaxException { - File file = createTempFile("sql", ".pack"); + final File file = createTempFile("sql", ".pack"); try (JarFile in = new JarFile(new File(Archive.class.getResource("/pack200/sqlUnpacked.jar").toURI())); FileOutputStream out = new FileOutputStream(file)) { final PackingOptions options = new PackingOptions(); diff --git a/src/test/java/org/apache/commons/compress/harmony/unpack200/tests/AbstractBandsTest.java b/src/test/java/org/apache/commons/compress/harmony/unpack200/tests/AbstractBandsTest.java index f32956637..f39f07cf5 100644 --- a/src/test/java/org/apache/commons/compress/harmony/unpack200/tests/AbstractBandsTest.java +++ b/src/test/java/org/apache/commons/compress/harmony/unpack200/tests/AbstractBandsTest.java @@ -39,7 +39,7 @@ public abstract class AbstractBandsTest { public AttributeLayoutMap getAttributeDefinitionMap() { try { return new AttributeLayoutMap(); - } catch (Pack200Exception e) { + } catch (final Pack200Exception e) { fail(e.getLocalizedMessage()); } return null; @@ -75,7 +75,7 @@ public abstract class AbstractBandsTest { public SegmentOptions getOptions() { try { return new SegmentOptions(0); - } catch (Pack200Exception e) { + } catch (final Pack200Exception e) { return null; } } diff --git a/src/test/java/org/apache/commons/compress/harmony/unpack200/tests/ArchiveTest.java b/src/test/java/org/apache/commons/compress/harmony/unpack200/tests/ArchiveTest.java index fe825ad7e..f169af182 100644 --- a/src/test/java/org/apache/commons/compress/harmony/unpack200/tests/ArchiveTest.java +++ b/src/test/java/org/apache/commons/compress/harmony/unpack200/tests/ArchiveTest.java @@ -55,7 +55,7 @@ public class ArchiveTest extends AbstractTempDirTest { if (in != null) { try { in.close(); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } } @@ -63,7 +63,7 @@ public class ArchiveTest extends AbstractTempDirTest { if (out != null) { out.close(); } - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } } diff --git a/src/test/java/org/apache/commons/compress/utils/FixedLengthBlockOutputStreamTest.java b/src/test/java/org/apache/commons/compress/utils/FixedLengthBlockOutputStreamTest.java index 98615014c..95aca1e80 100644 --- a/src/test/java/org/apache/commons/compress/utils/FixedLengthBlockOutputStreamTest.java +++ b/src/test/java/org/apache/commons/compress/utils/FixedLengthBlockOutputStreamTest.java @@ -228,7 +228,7 @@ public class FixedLengthBlockOutputStreamTest { Runtime.getRuntime().addShutdownHook(new Thread(() -> { try { Files.deleteIfExists(tempFile); - } catch (IOException ignore) { + } catch (final IOException ignore) { // ignore } }));