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 d6608c09c6ad9156b721b219aa690786f5115ede Author: Gary D. Gregory <garydgreg...@gmail.com> AuthorDate: Sun Dec 29 09:23:43 2024 -0500 Add Checkstyle EmptyBlock --- src/conf/checkstyle/checkstyle.xml | 3 +++ src/test/java/org/apache/commons/compress/archivers/SevenZTest.java | 2 +- .../apache/commons/compress/archivers/sevenz/SevenZFileTest.java | 4 +++- .../compressors/lz4/FramedLZ4CompressorInputStreamTest.java | 6 ++++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/conf/checkstyle/checkstyle.xml b/src/conf/checkstyle/checkstyle.xml index 13592e3ea..7943ce1fe 100644 --- a/src/conf/checkstyle/checkstyle.xml +++ b/src/conf/checkstyle/checkstyle.xml @@ -51,6 +51,9 @@ limitations under the License. <module name="AvoidStarImport" /> <module name="CovariantEquals" /> <module name="DefaultComesLast" /> + <module name="EmptyBlock"> + <property name="option" value="text" /> + </module> <module name="FinalLocalVariable" /> <module name="IllegalImport" /> <module name="ImportOrder"> diff --git a/src/test/java/org/apache/commons/compress/archivers/SevenZTest.java b/src/test/java/org/apache/commons/compress/archivers/SevenZTest.java index 76125c084..80502a213 100644 --- a/src/test/java/org/apache/commons/compress/archivers/SevenZTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/SevenZTest.java @@ -103,7 +103,7 @@ public class SevenZTest extends AbstractTest { final byte[] buf = new byte[1024]; int x = 0; while (0 <= (x = archive.read(buf))) { - + // do nothing } } diff --git a/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java b/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java index a131ca312..8e3f32ae9 100644 --- a/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java @@ -405,6 +405,7 @@ public class SevenZFileTest extends AbstractTest { public void testHandlesEmptyArchiveWithFilesInfo() throws Exception { final File file = newTempFile("empty.7z"); try (SevenZOutputFile s = new SevenZOutputFile(file)) { + // do nothing } try (SevenZFile z = SevenZFile.builder().setFile(file).get()) { assertFalse(z.getEntries().iterator().hasNext()); @@ -475,13 +476,13 @@ public class SevenZFileTest extends AbstractTest { testFiles.add(getPath("COMPRESS-542-2.7z")); testFiles.add(getPath("COMPRESS-542-endheadercorrupted.7z")); testFiles.add(getPath("COMPRESS-542-endheadercorrupted2.7z")); - for (final Path file : testFiles) { { final IOException e = assertThrows(IOException.class, () -> { try (@SuppressWarnings("deprecation") SevenZFile sevenZFile = new SevenZFile(Files.newByteChannel(file), SevenZFileOptions.builder().withTryToRecoverBrokenArchives(true).build())) { + // do nothing } }, "Expected IOException: start header corrupt and unable to guess end header"); assertEquals("Start header corrupt and unable to guess end header", e.getMessage()); @@ -490,6 +491,7 @@ public class SevenZFileTest extends AbstractTest { final IOException e = assertThrows(IOException.class, () -> { try (SevenZFile sevenZFile = SevenZFile.builder().setSeekableByteChannel(Files.newByteChannel(file)).setTryToRecoverBrokenArchives(true) .get()) { + // do nothing } }, "Expected IOException: start header corrupt and unable to guess end header"); assertEquals("Start header corrupt and unable to guess end header", e.getMessage()); diff --git a/src/test/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorInputStreamTest.java b/src/test/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorInputStreamTest.java index 06ca7c4bb..70b2a145f 100644 --- a/src/test/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorInputStreamTest.java +++ b/src/test/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorInputStreamTest.java @@ -257,6 +257,7 @@ public final class FramedLZ4CompressorInputStreamTest extends AbstractTest { 0, }; final IOException ex = assertThrows(IOException.class, () -> { try (InputStream a = new FramedLZ4CompressorInputStream(new ByteArrayInputStream(input))) { + // do nothing } }, "expected exception"); assertTrue(ex.getMessage().contains("header checksum mismatch")); @@ -270,6 +271,7 @@ public final class FramedLZ4CompressorInputStreamTest extends AbstractTest { }; final IOException ex = assertThrows(IOException.class, () -> { try (InputStream a = new FramedLZ4CompressorInputStream(new ByteArrayInputStream(input))) { + // do nothing } }, "expected exception"); assertTrue(ex.getMessage().contains("content size")); @@ -282,6 +284,7 @@ public final class FramedLZ4CompressorInputStreamTest extends AbstractTest { }; final IOException ex = assertThrows(IOException.class, () -> { try (InputStream a = new FramedLZ4CompressorInputStream(new ByteArrayInputStream(input))) { + // do nothing } }, "expected exception"); assertTrue(ex.getMessage().contains("BD byte")); @@ -293,6 +296,7 @@ public final class FramedLZ4CompressorInputStreamTest extends AbstractTest { }; final IOException ex = assertThrows(IOException.class, () -> { try (InputStream a = new FramedLZ4CompressorInputStream(new ByteArrayInputStream(input))) { + // do nothing } }, "expected exception"); assertTrue(ex.getMessage().contains("frame flags")); @@ -306,6 +310,7 @@ public final class FramedLZ4CompressorInputStreamTest extends AbstractTest { }; final IOException ex = assertThrows(IOException.class, () -> { try (InputStream a = new FramedLZ4CompressorInputStream(new ByteArrayInputStream(input))) { + // do nothing } }, "expected exception"); assertTrue(ex.getMessage().contains("header checksum")); @@ -318,6 +323,7 @@ public final class FramedLZ4CompressorInputStreamTest extends AbstractTest { }; final IOException ex = assertThrows(IOException.class, () -> { try (InputStream a = new FramedLZ4CompressorInputStream(new ByteArrayInputStream(input))) { + // do nothing } }, "expected exception"); assertTrue(ex.getMessage().contains("version"));