(commons-io) branch master updated (d6c14418 -> 31c72cd2)
This is an automated email from the ASF dual-hosted git repository. ggregory pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/commons-io.git from d6c14418 2.15.0 breaks backwards compatibility in PathUtils.fileContentEquals for the Zip file system new 2209fbb3 Javadoc new 31c72cd2 Remove profile made obsolete by parent POM The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: pom.xml| 38 -- .../io/monitor/FileAlterationObserverTest.java | 2 +- 2 files changed, 1 insertion(+), 39 deletions(-)
(commons-io) 01/02: Javadoc
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-io.git commit 2209fbb36c1714328a2a09c60d13171fc584f531 Author: Gary Gregory AuthorDate: Fri Nov 10 17:34:02 2023 -0500 Javadoc --- .../java/org/apache/commons/io/monitor/FileAlterationObserverTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/apache/commons/io/monitor/FileAlterationObserverTest.java b/src/test/java/org/apache/commons/io/monitor/FileAlterationObserverTest.java index 5edc6bb5..130105ea 100644 --- a/src/test/java/org/apache/commons/io/monitor/FileAlterationObserverTest.java +++ b/src/test/java/org/apache/commons/io/monitor/FileAlterationObserverTest.java @@ -36,7 +36,7 @@ import org.junit.jupiter.api.Test; public class FileAlterationObserverTest extends AbstractMonitorTest { /** - * Construct a new test case. + * Constructs a new instance. * */ public FileAlterationObserverTest() {
(commons-io) 02/02: Remove profile made obsolete by parent POM
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-io.git commit 31c72cd29af9c3f78f547268daea02766ba69cf3 Author: Gary Gregory AuthorDate: Fri Nov 10 17:36:38 2023 -0500 Remove profile made obsolete by parent POM --- pom.xml | 38 -- 1 file changed, 38 deletions(-) diff --git a/pom.xml b/pom.xml index c182a320..08f43e51 100644 --- a/pom.xml +++ b/pom.xml @@ -560,44 +560,6 @@ file comparators, endian transformation classes, and much more. 8 - - java9-moditect - - -[9,11) - - - - -org.moditect -moditect-maven-plugin -${commons.moditect.version} - - -add-module-infos -package - - add-module-info - - - 9 - ${project.build.directory} - true - - - org.apache.commons.io - - - - - - - - - benchmark
(commons-compress) branch master updated: Javadoc
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 d8804b50e Javadoc d8804b50e is described below commit d8804b50e00081ab238541aca3c395f6553c5375 Author: Gary Gregory AuthorDate: Fri Nov 10 17:33:28 2023 -0500 Javadoc --- .../archivers/cpio/CpioArchiveInputStream.java | 8 +++--- .../archivers/cpio/CpioArchiveOutputStream.java| 10 .../compress/archivers/tar/TarArchiveEntry.java| 30 +++--- .../archivers/tar/TarArchiveSparseEntry.java | 2 +- .../compress/archivers/zip/NioZipEncoding.java | 2 +- .../harmony/unpack200/AttributeLayout.java | 2 +- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java index 806e84430..20acf251a 100644 --- a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java +++ b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java @@ -156,7 +156,7 @@ public class CpioArchiveInputStream extends ArchiveInputStream final String encoding; /** - * Construct the cpio input stream with a blocksize of {@link + * Constructs the cpio input stream with a blocksize of {@link * CpioConstants#BLOCK_SIZE BLOCK_SIZE} and expecting ASCII file * names. * @@ -168,7 +168,7 @@ public class CpioArchiveInputStream extends ArchiveInputStream } /** - * Construct the cpio input stream with a blocksize of {@link + * Constructs the cpio input stream with a blocksize of {@link * CpioConstants#BLOCK_SIZE BLOCK_SIZE} expecting ASCII file * names. * @@ -183,7 +183,7 @@ public class CpioArchiveInputStream extends ArchiveInputStream } /** - * Construct the cpio input stream with a blocksize of {@link CpioConstants#BLOCK_SIZE BLOCK_SIZE}. + * Constructs the cpio input stream with a blocksize of {@link CpioConstants#BLOCK_SIZE BLOCK_SIZE}. * * @param in *The cpio stream @@ -206,7 +206,7 @@ public class CpioArchiveInputStream extends ArchiveInputStream } /** - * Construct the cpio input stream with a blocksize of {@link + * Constructs the cpio input stream with a blocksize of {@link * CpioConstants#BLOCK_SIZE BLOCK_SIZE}. * * @param in diff --git a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java index 872c6cef7..b5d59fda2 100644 --- a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java +++ b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java @@ -100,7 +100,7 @@ public class CpioArchiveOutputStream extends ArchiveOutputStreamThe entry's name will be the value of the {@code fileName} @@ -537,7 +537,7 @@ public class TarArchiveEntry implements ArchiveEntry, TarConstants, EntryStreamO } /** - * Construct an entry from an archive's header bytes. File is set to null. + * Constructs an entry from an archive's header bytes. File is set to null. * * @param globalPaxHeaders the parsed global PAX headers, or null if this is the first one. * @param headerBuf The header bytes from a tar archive entry. @@ -555,7 +555,7 @@ public class TarArchiveEntry implements ArchiveEntry, TarConstants, EntryStreamO } /** - * Construct an entry from an archive's header bytes for random access tar. File is set to null. + * Constructs an entry from an archive's header bytes for random access tar. File is set to null. * @param globalPaxHeaders the parsed global PAX headers, or null if this is the first one. * @param headerBuf the header bytes from a tar archive entry. * @param encoding encoding to use for file names. @@ -573,7 +573,7 @@ public class TarArchiveEntry implements ArchiveEntry, TarConstants, EntryStreamO } /** - * Construct an entry for a file. File is set to file, and the + * Constructs an entry for a file. File is set to file, and the * header is constructed from information from the file. * The name is set from the normalized file path. * @@ -592,7 +592,7 @@ public class TarArchiveEntry implements ArchiveEntry, TarConstants, EntryStreamO } /** - * Construct an entry for a file. File is set to file, and the + * Constructs an entry for a file. File is set to file, and the * header is constructed from information from the file. * * The entry's name will be the value of the {@code fileName} @@ -620,7
(commons-compress) branch master updated: [COMPRESS-647] Throw IOException instead of ArrayIndexOutOfBoundsException when reading Zip with data descriptor entries.
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 4c9659c4e [COMPRESS-647] Throw IOException instead of ArrayIndexOutOfBoundsException when reading Zip with data descriptor entries. 4c9659c4e is described below commit 4c9659c4ea66839e9219b3368b95af49dd032ba9 Author: Gary Gregory AuthorDate: Fri Nov 10 16:06:11 2023 -0500 [COMPRESS-647] Throw IOException instead of ArrayIndexOutOfBoundsException when reading Zip with data descriptor entries. --- src/changes/changes.xml | 1 + .../archivers/zip/ZipArchiveInputStream.java | 4 .../archivers/zip/ZipArchiveInputStreamTest.java | 19 +++ src/test/resources/COMPRESS-647/test.zip | Bin 0 -> 107 bytes 4 files changed, 24 insertions(+) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index ceabe3e6d..9359f8210 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -88,6 +88,7 @@ The type attribute can be add,update,fix,remove. Calling PackingUtils.config(PackingOptions) with null now closes the internal FileHandler. LZ4 compressor throws IndexOutOfBoundsException. LZWInputStream.initializeTables(int) should throw IllegalArgumentException instead of ArrayIndexOutOfBoundsException. + Throw IOException instead of ArrayIndexOutOfBoundsException when reading Zip with data descriptor entries. Bump org.slf4j:slf4j-api from 2.0.8 to 2.0.9 #413. Bump commons-io:commons-io from 2.13.0 to 2.15.0. diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java index dafa78b72..7b750ad07 100644 --- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java +++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java @@ -984,6 +984,10 @@ public class ZipArchiveInputStream extends ArchiveInputStream i } private void pushback(final byte[] buf, final int offset, final int length) throws IOException { +if (offset < 0) { +// Instead of ArrayIndexOutOfBoundsException +throw new IOException(String.format("Negative offset %,d into buffer", offset)); +} ((PushbackInputStream) inputStream).unread(buf, offset, length); pushedBackBytes(length); } 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 0189a666a..b172724a5 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 @@ -24,6 +24,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; @@ -35,6 +36,7 @@ import java.io.InputStream; import java.nio.channels.Channels; import java.nio.channels.SeekableByteChannel; import java.nio.file.Files; +import java.nio.file.Paths; import java.time.Instant; import java.util.Arrays; import java.util.zip.ZipEntry; @@ -47,6 +49,8 @@ import org.apache.commons.compress.archivers.ArchiveStreamFactory; import org.apache.commons.compress.utils.ByteUtils; import org.apache.commons.compress.utils.IOUtils; import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; public class ZipArchiveInputStreamTest extends AbstractTest { @@ -709,4 +713,19 @@ public class ZipArchiveInputStreamTest extends AbstractTest { getAllZipEntries(zipInputStream); } } + +@ParameterizedTest +@ValueSource(booleans = { true, false }) +public void zipInputStream(final boolean allowStoredEntriesWithDataDescriptor) { +try (ZipArchiveInputStream zIn = new ZipArchiveInputStream( + Files.newInputStream(Paths.get("src/test/resources/COMPRESS-647/test.zip")), "UTF-8", false, +allowStoredEntriesWithDataDescriptor)) { +ZipArchiveEntry zae = zIn.getNextEntry(); +while (zae != null) { +zae = zIn.getNextEntry(); +} +} catch (IOException e) { +// Ignore expected exception +} +} } diff --git a/src/test/resources/COMPRESS-647/test.zip
(commons-compress) branch master updated: Sort members
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 75cb7770d Sort members 75cb7770d is described below commit 75cb7770dc3784876cf738a279614ad1b56c039e Author: Gary Gregory AuthorDate: Fri Nov 10 15:51:34 2023 -0500 Sort members --- .../compress/archivers/examples/ExpanderTest.java | 18 ++-- .../commons/compress/archivers/tar/BigFilesIT.java | 32 +++--- .../archivers/tar/TarMemoryFileSystemTest.java | 60 ++-- .../archivers/zip/ZipArchiveInputStreamTest.java | 108 ++--- .../compress/archivers/zip/ZipFileTest.java| 14 +-- .../harmony/pack200/tests/PackingOptionsTest.java | 80 +++ .../MultiReadOnlySeekableByteChannelTest.java | 50 +- .../utils/SeekableInMemoryByteChannelTest.java | 78 +++ 8 files changed, 220 insertions(+), 220 deletions(-) diff --git a/src/test/java/org/apache/commons/compress/archivers/examples/ExpanderTest.java b/src/test/java/org/apache/commons/compress/archivers/examples/ExpanderTest.java index 07dced361..72c3cb935 100644 --- a/src/test/java/org/apache/commons/compress/archivers/examples/ExpanderTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/examples/ExpanderTest.java @@ -174,15 +174,6 @@ public class ExpanderTest extends AbstractTest { } } -@Test -public void testTarFileVersion() throws IOException, ArchiveException { -setupTar(); -try (TarFile f = new TarFile(archive)) { -new Expander().expand(f, tempResultDir); -} -verifyTargetDir(); -} - @Test public void testCompress603Tar() throws IOException, ArchiveException { setupTarForCompress603(); @@ -270,6 +261,15 @@ public class ExpanderTest extends AbstractTest { verifyTargetDir(); } +@Test +public void testTarFileVersion() throws IOException, ArchiveException { +setupTar(); +try (TarFile f = new TarFile(archive)) { +new Expander().expand(f, tempResultDir); +} +verifyTargetDir(); +} + @Test public void testZipFileVersion() throws IOException, ArchiveException { setupZip(); diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/BigFilesIT.java b/src/test/java/org/apache/commons/compress/archivers/tar/BigFilesIT.java index beaf0f659..2b58c4593 100644 --- a/src/test/java/org/apache/commons/compress/archivers/tar/BigFilesIT.java +++ b/src/test/java/org/apache/commons/compress/archivers/tar/BigFilesIT.java @@ -61,22 +61,6 @@ public class BigFilesIT extends AbstractTest { } } -@Test -public void testTarFileReadFileHeadersOfArchiveBiggerThan8GByte() throws Exception { -final Path file = getPath("8.posix.tar.gz"); -final Path output = tempResultDir.toPath().resolve("8.posix.tar"); -try (InputStream in = new BufferedInputStream(Files.newInputStream(file)); - GzipCompressorInputStream gzin = new GzipCompressorInputStream(in)) { -Files.copy(gzin, output, StandardCopyOption.REPLACE_EXISTING); -} - -try (final TarFile tarFile = new TarFile(output)) { -final List entries = tarFile.getEntries(); -assertEquals(1, entries.size()); -assertNotNull(entries.get(0)); -} -} - @Test public void testReadFileBiggerThan8GBytePosix() throws Exception { readFileBiggerThan8GByte("8.posix.tar.gz"); @@ -98,4 +82,20 @@ public class BigFilesIT extends AbstractTest { } } +@Test +public void testTarFileReadFileHeadersOfArchiveBiggerThan8GByte() throws Exception { +final Path file = getPath("8.posix.tar.gz"); +final Path output = tempResultDir.toPath().resolve("8.posix.tar"); +try (InputStream in = new BufferedInputStream(Files.newInputStream(file)); + GzipCompressorInputStream gzin = new GzipCompressorInputStream(in)) { +Files.copy(gzin, output, StandardCopyOption.REPLACE_EXISTING); +} + +try (final TarFile tarFile = new TarFile(output)) { +final List entries = tarFile.getEntries(); +assertEquals(1, entries.size()); +assertNotNull(entries.get(0)); +} +} + } diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/TarMemoryFileSystemTest.java b/src/test/java/org/apache/commons/compress/archivers/tar/TarMemoryFileSystemTest.java index 4afe2cebc..78c8194b8 100644 --- a/src/test/java/org/apache/commons/compress/archivers/tar/TarMemoryFileSystemTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/tar/TarMemoryFileSystemTest.java @@ -42,6 +42,36 @@ import com.github.marschall.memoryfilesystem.MemoryFileSystemBuilder;
(commons-compress) 04/07: Use final
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 b03f5c515c2f1fbddd30bd201239e1bf13b6ddda Author: Gary Gregory AuthorDate: Fri Nov 10 15:44:14 2023 -0500 Use final Sort members --- .../compressors/CompressorStreamFactory.java | 4 +- .../compress/compressors/DetectCompressorTest.java | 190 ++--- 2 files changed, 97 insertions(+), 97 deletions(-) diff --git a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java b/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java index 5bc2e786d..4629633cd 100644 --- a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java +++ b/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java @@ -208,6 +208,8 @@ public class CompressorStreamFactory implements CompressorStreamProvider { private static final String YOU_NEED_XZ_JAVA = youNeed("XZ for Java", "https://tukaani.org/xz/java.html;); private static final String YOU_NEED_ZSTD_JNI = youNeed("Zstd JNI", "https://github.com/luben/zstd-jni;); +private static final Set ALL_NAMES = Sets.newHashSet(BZIP2, GZIP, PACK200, SNAPPY_FRAMED, Z, DEFLATE, XZ, LZMA, LZ4_FRAMED, ZSTANDARD); + private static Iterable archiveStreamProviderIterable() { return ServiceLoader.load(CompressorStreamProvider.class, ClassLoader.getSystemClassLoader()); } @@ -476,8 +478,6 @@ public class CompressorStreamFactory implements CompressorStreamProvider { private final int memoryLimitInKb; -private static final Set ALL_NAMES = Sets.newHashSet(BZIP2, GZIP, PACK200, SNAPPY_FRAMED, Z, DEFLATE, XZ, LZMA, LZ4_FRAMED, ZSTANDARD); - /** * Constructs an instance with the decompress Concatenated option set to false. */ 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 c8970294a..4acda7b5f 100644 --- a/src/test/java/org/apache/commons/compress/compressors/DetectCompressorTest.java +++ b/src/test/java/org/apache/commons/compress/compressors/DetectCompressorTest.java @@ -80,6 +80,21 @@ public final class DetectCompressorTest { factorySetFalse.setDecompressConcatenated(false); } +public static Stream getDetectLimitedByNameParams() { +return Stream.of( +Arguments.of("bla.txt.bz2", CompressorStreamFactory.BZIP2), +Arguments.of("bla.tgz", CompressorStreamFactory.GZIP), +Arguments.of("bla.pack", CompressorStreamFactory.PACK200), +Arguments.of("bla.tar.xz", CompressorStreamFactory.XZ), +Arguments.of("bla.tar.deflatez", CompressorStreamFactory.DEFLATE), +Arguments.of("bla.tar.lz4", CompressorStreamFactory.LZ4_FRAMED), +Arguments.of("bla.tar.lzma", CompressorStreamFactory.LZMA), +Arguments.of("bla.tar.sz", CompressorStreamFactory.SNAPPY_FRAMED), +Arguments.of("bla.tar.Z", CompressorStreamFactory.Z), +Arguments.of("bla.tar.zst", CompressorStreamFactory.ZSTANDARD) +); +} + final CompressorStreamFactory factory = new CompressorStreamFactory(); private final TestData[] tests = { @@ -109,11 +124,6 @@ public final class DetectCompressorTest { getFile(resource).toPath(; } -@SuppressWarnings("resource") // Caller closes. -private CompressorInputStream createStreamFor(final String resource, final Set compressorNames) throws CompressorException, IOException { -return factory.createCompressorInputStream(new BufferedInputStream(Files.newInputStream(getFile(resource).toPath())), compressorNames); -} - @SuppressWarnings("resource") // Caller closes. private CompressorInputStream createStreamFor(final String resource, final CompressorStreamFactory factory) throws CompressorException, IOException { return factory.createCompressorInputStream(new BufferedInputStream(Files.newInputStream(getFile(resource).toPath(; @@ -134,6 +144,11 @@ public final class DetectCompressorTest { } +@SuppressWarnings("resource") // Caller closes. +private CompressorInputStream createStreamFor(final String resource, final Set compressorNames) throws CompressorException, IOException { +return factory.createCompressorInputStream(new BufferedInputStream(Files.newInputStream(getFile(resource).toPath())), compressorNames); +} + private String detect(final String testFileName) throws IOException, CompressorException { return detect(testFileName, null); } @@ -145,72 +160,46 @@ public final class DetectCompressorTest { } @Test -public void testDetect() throws
(commons-compress) branch master updated (5a8ab16a8 -> e0f355031)
This is an automated email from the ASF dual-hosted git repository. ggregory pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/commons-compress.git from 5a8ab16a8 [COMPRESS-648] Add ability to restrict autodetection in CompressorStreamFactory #433 new 4e6eaef54 Javadoc new 8dd9884d6 Refactor constant new 3d0d57ca3 Next version will be 1.25.0 new b03f5c515 Use final new 1133031d0 Format new aa48cde59 Better test method names new e0f355031 Format tweak The 7 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../compressors/CompressorStreamFactory.java | 26 +- .../compress/compressors/DetectCompressorTest.java | 268 +++-- 2 files changed, 149 insertions(+), 145 deletions(-)
(commons-compress) 05/07: Format
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 1133031d03cb3b3e1ca04c45568436ed9e65cd94 Author: Gary Gregory AuthorDate: Fri Nov 10 15:45:46 2023 -0500 Format --- .../compress/compressors/DetectCompressorTest.java | 56 +++--- 1 file changed, 29 insertions(+), 27 deletions(-) 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 4acda7b5f..4bc773a89 100644 --- a/src/test/java/org/apache/commons/compress/compressors/DetectCompressorTest.java +++ b/src/test/java/org/apache/commons/compress/compressors/DetectCompressorTest.java @@ -66,6 +66,7 @@ public final class DetectCompressorTest { this.concat = concat; } } + private static final CompressorStreamFactory factoryTrue = new CompressorStreamFactory(true); private static final CompressorStreamFactory factoryFalse = new CompressorStreamFactory(false); @@ -81,18 +82,20 @@ public final class DetectCompressorTest { } public static Stream getDetectLimitedByNameParams() { +// @formatter:off return Stream.of( -Arguments.of("bla.txt.bz2", CompressorStreamFactory.BZIP2), -Arguments.of("bla.tgz", CompressorStreamFactory.GZIP), -Arguments.of("bla.pack", CompressorStreamFactory.PACK200), -Arguments.of("bla.tar.xz", CompressorStreamFactory.XZ), -Arguments.of("bla.tar.deflatez", CompressorStreamFactory.DEFLATE), -Arguments.of("bla.tar.lz4", CompressorStreamFactory.LZ4_FRAMED), -Arguments.of("bla.tar.lzma", CompressorStreamFactory.LZMA), -Arguments.of("bla.tar.sz", CompressorStreamFactory.SNAPPY_FRAMED), -Arguments.of("bla.tar.Z", CompressorStreamFactory.Z), -Arguments.of("bla.tar.zst", CompressorStreamFactory.ZSTANDARD) +Arguments.of("bla.txt.bz2", CompressorStreamFactory.BZIP2), +Arguments.of("bla.tgz", CompressorStreamFactory.GZIP), +Arguments.of("bla.pack", CompressorStreamFactory.PACK200), +Arguments.of("bla.tar.xz", CompressorStreamFactory.XZ), +Arguments.of("bla.tar.deflatez", CompressorStreamFactory.DEFLATE), +Arguments.of("bla.tar.lz4", CompressorStreamFactory.LZ4_FRAMED), +Arguments.of("bla.tar.lzma", CompressorStreamFactory.LZMA), +Arguments.of("bla.tar.sz", CompressorStreamFactory.SNAPPY_FRAMED), +Arguments.of("bla.tar.Z", CompressorStreamFactory.Z), +Arguments.of("bla.tar.zst", CompressorStreamFactory.ZSTANDARD) ); +// @formatter:on } final CompressorStreamFactory factory = new CompressorStreamFactory(); @@ -119,9 +122,7 @@ public final class DetectCompressorTest { @SuppressWarnings("resource") // Caller closes. private CompressorInputStream createStreamFor(final String resource) throws CompressorException, IOException { -return factory.createCompressorInputStream( - new BufferedInputStream(Files.newInputStream( - getFile(resource).toPath(; +return factory.createCompressorInputStream(new BufferedInputStream(Files.newInputStream(getFile(resource).toPath(; } @SuppressWarnings("resource") // Caller closes. @@ -136,7 +137,7 @@ public final class DetectCompressorTest { return fac.createCompressorInputStream(is); } catch (final CompressorException e) { if (e.getCause() != null && e.getCause() instanceof Exception) { -//unwrap cause to reveal MemoryLimitException +// unwrap cause to reveal MemoryLimitException throw (Exception) e.getCause(); } throw e; @@ -250,16 +251,19 @@ public final class DetectCompressorTest { assertEquals(CompressorStreamFactory.Z, detect("bla.tar.Z")); assertEquals(CompressorStreamFactory.ZSTANDARD, detect("bla.tar.zst")); -//make sure we don't oom on detect +// make sure we don't oom on detect assertEquals(CompressorStreamFactory.Z, detect("COMPRESS-386")); assertEquals(CompressorStreamFactory.LZMA, detect("COMPRESS-382")); -assertThrows(CompressorException.class, () -> CompressorStreamFactory.detect(new BufferedInputStream(new ByteArrayInputStream(ByteUtils.EMPTY_BYTE_ARRAY; +assertThrows(CompressorException.class, +() -> CompressorStreamFactory.detect(new BufferedInputStream(new ByteArrayInputStream(ByteUtils.EMPTY_BYTE_ARRAY; -final IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> CompressorStreamFactory.detect(null), "shouldn't be able
(commons-compress) 02/07: Refactor constant
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 8dd9884d63b83c0b7e61acc5973c7bd17e661d77 Author: Gary Gregory AuthorDate: Fri Nov 10 15:40:40 2023 -0500 Refactor constant --- .../apache/commons/compress/compressors/CompressorStreamFactory.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java b/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java index c57e4dd01..f9d3938ef 100644 --- a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java +++ b/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java @@ -224,8 +224,7 @@ public class CompressorStreamFactory implements CompressorStreamProvider { * @since 1.14 */ public static String detect(final InputStream inputStream) throws CompressorException { -final Set defaultCompressorNamesForDetection = Sets.newHashSet(BZIP2, GZIP, PACK200, SNAPPY_FRAMED, Z, DEFLATE, XZ, LZMA, LZ4_FRAMED, ZSTANDARD); -return detect(inputStream, defaultCompressorNamesForDetection); +return detect(inputStream, ALL_NAMES); } /** @@ -477,6 +476,8 @@ public class CompressorStreamFactory implements CompressorStreamProvider { private final int memoryLimitInKb; +private static final Set ALL_NAMES = Sets.newHashSet(BZIP2, GZIP, PACK200, SNAPPY_FRAMED, Z, DEFLATE, XZ, LZMA, LZ4_FRAMED, ZSTANDARD); + /** * Constructs an instance with the decompress Concatenated option set to false. */
(commons-compress) 06/07: Better test method names
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 aa48cde59e5b9dfe9e3643b8cc2e08716efc94b6 Author: Gary Gregory AuthorDate: Fri Nov 10 15:46:56 2023 -0500 Better test method names --- .../compress/compressors/DetectCompressorTest.java | 66 +++--- 1 file changed, 33 insertions(+), 33 deletions(-) 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 4bc773a89..5e3e16f0e 100644 --- a/src/test/java/org/apache/commons/compress/compressors/DetectCompressorTest.java +++ b/src/test/java/org/apache/commons/compress/compressors/DetectCompressorTest.java @@ -121,16 +121,21 @@ public final class DetectCompressorTest { }; @SuppressWarnings("resource") // Caller closes. -private CompressorInputStream createStreamFor(final String resource) throws CompressorException, IOException { +private CompressorInputStream createCompressorInputStream(final String resource) throws CompressorException, IOException { return factory.createCompressorInputStream(new BufferedInputStream(Files.newInputStream(getFile(resource).toPath(; } @SuppressWarnings("resource") // Caller closes. -private CompressorInputStream createStreamFor(final String resource, final CompressorStreamFactory factory) throws CompressorException, IOException { +private CompressorInputStream createCompressorInputStream(final String resource, final CompressorStreamFactory factory) throws CompressorException, IOException { return factory.createCompressorInputStream(new BufferedInputStream(Files.newInputStream(getFile(resource).toPath(; } -private InputStream createStreamFor(final String fileName, final int memoryLimitInKb) throws Exception { +@SuppressWarnings("resource") // Caller closes. +private CompressorInputStream createCompressorInputStream(final String resource, final Set compressorNames) throws CompressorException, IOException { +return factory.createCompressorInputStream(new BufferedInputStream(Files.newInputStream(getFile(resource).toPath())), compressorNames); +} + +private InputStream createInputStream(final String fileName, final int memoryLimitInKb) throws Exception { final CompressorStreamFactory fac = new CompressorStreamFactory(true, memoryLimitInKb); final InputStream is = new BufferedInputStream(Files.newInputStream(getFile(fileName).toPath())); try { @@ -145,11 +150,6 @@ public final class DetectCompressorTest { } -@SuppressWarnings("resource") // Caller closes. -private CompressorInputStream createStreamFor(final String resource, final Set compressorNames) throws CompressorException, IOException { -return factory.createCompressorInputStream(new BufferedInputStream(Files.newInputStream(getFile(resource).toPath())), compressorNames); -} - private String detect(final String testFileName) throws IOException, CompressorException { return detect(testFileName, null); } @@ -162,32 +162,32 @@ public final class DetectCompressorTest { @Test public void testCreateLimitedByName() throws Exception { -try (CompressorInputStream bzip2 = createStreamFor("bla.txt.bz2", Collections.singleton(CompressorStreamFactory.BZIP2))) { +try (CompressorInputStream bzip2 = createCompressorInputStream("bla.txt.bz2", Collections.singleton(CompressorStreamFactory.BZIP2))) { assertNotNull(bzip2); assertTrue(bzip2 instanceof BZip2CompressorInputStream); } -try (CompressorInputStream gzip = createStreamFor("bla.tgz", Collections.singleton(CompressorStreamFactory.GZIP))) { +try (CompressorInputStream gzip = createCompressorInputStream("bla.tgz", Collections.singleton(CompressorStreamFactory.GZIP))) { assertNotNull(gzip); assertTrue(gzip instanceof GzipCompressorInputStream); } -try (CompressorInputStream pack200 = createStreamFor("bla.pack", Collections.singleton(CompressorStreamFactory.PACK200))) { +try (CompressorInputStream pack200 = createCompressorInputStream("bla.pack", Collections.singleton(CompressorStreamFactory.PACK200))) { assertNotNull(pack200); assertTrue(pack200 instanceof Pack200CompressorInputStream); } -try (CompressorInputStream xz = createStreamFor("bla.tar.xz", Collections.singleton(CompressorStreamFactory.XZ))) { +try (CompressorInputStream xz = createCompressorInputStream("bla.tar.xz", Collections.singleton(CompressorStreamFactory.XZ))) { assertNotNull(xz); assertTrue(xz instanceof XZCompressorInputStream); } -try (CompressorInputStream zlib
(commons-compress) 07/07: Format tweak
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 e0f355031f76da4c5a6d5905af46953246c31b1a Author: Gary Gregory AuthorDate: Fri Nov 10 15:48:57 2023 -0500 Format tweak --- .../compress/compressors/DetectCompressorTest.java | 36 -- 1 file changed, 19 insertions(+), 17 deletions(-) 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 5e3e16f0e..0adbd83e3 100644 --- a/src/test/java/org/apache/commons/compress/compressors/DetectCompressorTest.java +++ b/src/test/java/org/apache/commons/compress/compressors/DetectCompressorTest.java @@ -101,23 +101,25 @@ public final class DetectCompressorTest { final CompressorStreamFactory factory = new CompressorStreamFactory(); private final TestData[] tests = { -new TestData("multiple.bz2", new char[]{'a','b'}, factoryTrue, true), -new TestData("multiple.bz2", new char[]{'a','b'}, factorySetTrue, true), -new TestData("multiple.bz2", new char[]{'a'}, factoryFalse, false), -new TestData("multiple.bz2", new char[]{'a'}, factorySetFalse, false), -new TestData("multiple.bz2", new char[]{'a'}, factory, false), - -new TestData("multiple.gz", new char[]{'a','b'}, factoryTrue, true), -new TestData("multiple.gz", new char[]{'a','b'}, factorySetTrue, true), -new TestData("multiple.gz", new char[]{'a'}, factoryFalse, false), -new TestData("multiple.gz", new char[]{'a'}, factorySetFalse, false), -new TestData("multiple.gz", new char[]{'a'}, factory, false), - -new TestData("multiple.xz", new char[]{'a','b'}, factoryTrue, true), -new TestData("multiple.xz", new char[]{'a','b'}, factorySetTrue, true), -new TestData("multiple.xz", new char[]{'a'}, factoryFalse, false), -new TestData("multiple.xz", new char[]{'a'}, factorySetFalse, false), -new TestData("multiple.xz", new char[]{'a'}, factory, false), +// @formatter:off +new TestData("multiple.bz2", new char[] { 'a', 'b' }, factoryTrue, true), +new TestData("multiple.bz2", new char[] { 'a', 'b' }, factorySetTrue, true), +new TestData("multiple.bz2", new char[] { 'a' }, factoryFalse, false), +new TestData("multiple.bz2", new char[] { 'a' }, factorySetFalse, false), +new TestData("multiple.bz2", new char[] { 'a' }, factory, false), + +new TestData("multiple.gz", new char[] { 'a', 'b' }, factoryTrue, true), +new TestData("multiple.gz", new char[] { 'a', 'b' }, factorySetTrue, true), +new TestData("multiple.gz", new char[] { 'a' }, factoryFalse, false), +new TestData("multiple.gz", new char[] { 'a' }, factorySetFalse, false), +new TestData("multiple.gz", new char[] { 'a' }, factory, false), + +new TestData("multiple.xz", new char[] { 'a', 'b' }, factoryTrue, true), +new TestData("multiple.xz", new char[] { 'a', 'b' }, factorySetTrue, true), +new TestData("multiple.xz", new char[] { 'a' }, factoryFalse, false), +new TestData("multiple.xz", new char[] { 'a' }, factorySetFalse, false), +new TestData("multiple.xz", new char[] { 'a' }, factory, false), +// @formatter:off }; @SuppressWarnings("resource") // Caller closes.
(commons-compress) 03/07: Next version will be 1.25.0
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 3d0d57ca359b2f205b9cb4a0c10def42bbb68826 Author: Gary Gregory AuthorDate: Fri Nov 10 15:42:23 2023 -0500 Next version will be 1.25.0 --- .../apache/commons/compress/compressors/CompressorStreamFactory.java| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java b/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java index f9d3938ef..5bc2e786d 100644 --- a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java +++ b/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java @@ -555,7 +555,7 @@ public class CompressorStreamFactory implements CompressorStreamProvider { * if the autodetected compressor is not in the provided set of compressor names * @throws IllegalArgumentException * if the stream is null or does not support mark - * @since 1.26 + * @since 1.25.0 */ public CompressorInputStream createCompressorInputStream(final InputStream in, final Set compressorNames) throws CompressorException {
(commons-compress) 01/07: Javadoc
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 4e6eaef5435533b5e6a29925be1f0ae253b9a20a Author: Gary Gregory AuthorDate: Fri Nov 10 15:39:35 2023 -0500 Javadoc --- .../compress/compressors/CompressorStreamFactory.java | 19 +-- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java b/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java index 3f604cfcb..c57e4dd01 100644 --- a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java +++ b/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java @@ -213,7 +213,7 @@ public class CompressorStreamFactory implements CompressorStreamProvider { } /** - * Try to detect the type of compressor stream. + * Detects the type of compressor stream. * * @param inputStream input stream * @return type of compressor stream detected @@ -229,7 +229,7 @@ public class CompressorStreamFactory implements CompressorStreamProvider { } /** - * Try to detect the type of compressor stream while limiting the type to the provided set of compressor names. + * Detects the type of compressor stream while limiting the type to the provided set of compressor names. * * @param inputStream input stream * @param compressorNames compressor names to limit autodetection @@ -478,7 +478,7 @@ public class CompressorStreamFactory implements CompressorStreamProvider { private final int memoryLimitInKb; /** - * Create an instance with the decompress Concatenated option set to false. + * Constructs an instance with the decompress Concatenated option set to false. */ public CompressorStreamFactory() { this.decompressUntilEOF = null; @@ -486,7 +486,7 @@ public class CompressorStreamFactory implements CompressorStreamProvider { } /** - * Create an instance with the provided decompress Concatenated option. + * Constructs an instance with the provided decompress Concatenated option. * * @param decompressUntilEOF *if true, decompress until the end of the input; if false, stop @@ -500,14 +500,13 @@ public class CompressorStreamFactory implements CompressorStreamProvider { } /** - * Create an instance with the provided decompress Concatenated option. + * Constructs an instance with the provided decompress Concatenated option. * * @param decompressUntilEOF *if true, decompress until the end of the input; if false, stop *after the first stream and leave the input position to point *to the next byte after the stream. This setting applies to the *gzip, bzip2 and XZ formats only. - * * @param memoryLimitInKb *Some streams require allocation of potentially significant *byte arrays/tables, and they can offer checks to prevent OOMs @@ -524,7 +523,7 @@ public class CompressorStreamFactory implements CompressorStreamProvider { } /** - * Create a compressor input stream from an input stream, auto-detecting the + * Creates a compressor input stream from an input stream, auto-detecting the * compressor type from the first few bytes of the stream. The InputStream * must support marks, like BufferedInputStream. * @@ -542,7 +541,7 @@ public class CompressorStreamFactory implements CompressorStreamProvider { } /** - * Create a compressor input stream from an input stream, auto-detecting the + * Creates a compressor input stream from an input stream, auto-detecting the * compressor type from the first few bytes of the stream while limiting the detected type * to the provided set of compressor names. The InputStream must support marks, like BufferedInputStream. * @@ -767,7 +766,7 @@ public class CompressorStreamFactory implements CompressorStreamProvider { return compressorOutputStreamProviders; } -// For Unit tests +/** For tests. */ boolean getDecompressConcatenated() { return decompressConcatenated; } @@ -788,7 +787,7 @@ public class CompressorStreamFactory implements CompressorStreamProvider { } /** - * Whether to decompress the full input or only the first stream in formats + * Sets whether to decompress the full input or only the first stream in formats * supporting multiple concatenated input streams. * *
(commons-compress) branch master updated: [COMPRESS-648] Add ability to restrict autodetection in CompressorStreamFactory #433
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 5a8ab16a8 [COMPRESS-648] Add ability to restrict autodetection in CompressorStreamFactory #433 5a8ab16a8 is described below commit 5a8ab16a86a818b698b99764a06d628df317b203 Author: Gary Gregory AuthorDate: Fri Nov 10 15:37:51 2023 -0500 [COMPRESS-648] Add ability to restrict autodetection in CompressorStreamFactory #433 --- src/changes/changes.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 412805e02..ceabe3e6d 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -68,6 +68,7 @@ The type attribute can be add,update,fix,remove. Add generics to ArchiveStreamProvider and friends. Add a generic type parameter to ArchiveOutputStream and avoid unchecked/unconfirmed type casts in subclasses. Add a generic type parameter to ArchiveInputStream and deprecate redundant get methods in subclasses. + Add ability to restrict autodetection in CompressorStreamFactory #433. Precompile regular expression in ArArchiveInputStream.isBSDLongName(String). Precompile regular expression in ArArchiveInputStream.isGNULongName(String).
(commons-compress) branch master updated: [COMPRESS-648] Add ability to restrict autodetection in CompressorStreamFactory (#433)
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 ab8316c57 [COMPRESS-648] Add ability to restrict autodetection in CompressorStreamFactory (#433) ab8316c57 is described below commit ab8316c57b0a1ce62b6c58c7d459132e6e735be9 Author: Yakov Shafranovich AuthorDate: Fri Nov 10 15:36:28 2023 -0500 [COMPRESS-648] Add ability to restrict autodetection in CompressorStreamFactory (#433) * Changes for COMPRESS-648 * Added comment * refactored * Removed line breaks and changed one method to package-private * refactoring test * Removed unused import - Co-authored-by: Yakov Shafranovich --- .../compressors/CompressorStreamFactory.java | 62 -- .../compress/compressors/DetectCompressorTest.java | 131 ++--- 2 files changed, 164 insertions(+), 29 deletions(-) diff --git a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java b/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java index fc7c7fe5e..3f604cfcb 100644 --- a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java +++ b/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java @@ -224,10 +224,29 @@ public class CompressorStreamFactory implements CompressorStreamProvider { * @since 1.14 */ public static String detect(final InputStream inputStream) throws CompressorException { +final Set defaultCompressorNamesForDetection = Sets.newHashSet(BZIP2, GZIP, PACK200, SNAPPY_FRAMED, Z, DEFLATE, XZ, LZMA, LZ4_FRAMED, ZSTANDARD); +return detect(inputStream, defaultCompressorNamesForDetection); +} + +/** + * Try to detect the type of compressor stream while limiting the type to the provided set of compressor names. + * + * @param inputStream input stream + * @param compressorNames compressor names to limit autodetection + * @return type of compressor stream detected + * @throws CompressorException if no compressor stream type was detected + * or if something else went wrong + * @throws IllegalArgumentException if stream is null or does not support mark + */ +static String detect(final InputStream inputStream, final Set compressorNames) throws CompressorException { if (inputStream == null) { throw new IllegalArgumentException("Stream must not be null."); } +if (compressorNames == null || compressorNames.isEmpty()) { +throw new IllegalArgumentException("Compressor names cannot be null or empty"); +} + if (!inputStream.markSupported()) { throw new IllegalArgumentException("Mark is not supported."); } @@ -242,43 +261,44 @@ public class CompressorStreamFactory implements CompressorStreamProvider { throw new CompressorException("IOException while reading signature.", e); } -if (BZip2CompressorInputStream.matches(signature, signatureLength)) { +if (compressorNames.contains(BZIP2) && BZip2CompressorInputStream.matches(signature, signatureLength)) { return BZIP2; } -if (GzipCompressorInputStream.matches(signature, signatureLength)) { +if (compressorNames.contains(GZIP) && GzipCompressorInputStream.matches(signature, signatureLength)) { return GZIP; } -if (Pack200CompressorInputStream.matches(signature, signatureLength)) { +if (compressorNames.contains(PACK200) && Pack200CompressorInputStream.matches(signature, signatureLength)) { return PACK200; } -if (FramedSnappyCompressorInputStream.matches(signature, signatureLength)) { +if (compressorNames.contains(SNAPPY_FRAMED) && +FramedSnappyCompressorInputStream.matches(signature, signatureLength)) { return SNAPPY_FRAMED; } -if (ZCompressorInputStream.matches(signature, signatureLength)) { +if (compressorNames.contains(Z) && ZCompressorInputStream.matches(signature, signatureLength)) { return Z; } -if (DeflateCompressorInputStream.matches(signature, signatureLength)) { +if (compressorNames.contains(DEFLATE) && DeflateCompressorInputStream.matches(signature, signatureLength)) { return DEFLATE; } -if (XZUtils.matches(signature, signatureLength)) { +if (compressorNames.contains(XZ) && XZUtils.matches(signature, signatureLength)) { return XZ; } -if (LZMAUtils.matches(signature, signatureLength)) { +if (compressorNames.contains(LZMA) &&
(commons-rdf) branch dependabot/maven/org.eclipse.rdf4j-rdf4j-bom-4.3.7 deleted (was 67abfb73)
This is an automated email from the ASF dual-hosted git repository. github-bot pushed a change to branch dependabot/maven/org.eclipse.rdf4j-rdf4j-bom-4.3.7 in repository https://gitbox.apache.org/repos/asf/commons-rdf.git was 67abfb73 Bump org.eclipse.rdf4j:rdf4j-bom from 3.7.7 to 4.3.7 The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(commons-rdf) branch dependabot/maven/org.eclipse.rdf4j-rdf4j-bom-4.3.8 created (now 280e0724)
This is an automated email from the ASF dual-hosted git repository. github-bot pushed a change to branch dependabot/maven/org.eclipse.rdf4j-rdf4j-bom-4.3.8 in repository https://gitbox.apache.org/repos/asf/commons-rdf.git at 280e0724 Bump org.eclipse.rdf4j:rdf4j-bom from 3.7.7 to 4.3.8 No new revisions were added by this update.
(commons-fileupload) branch master updated: Pick up Maven Moditect plugin version from parent POM
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-fileupload.git The following commit(s) were added to refs/heads/master by this push: new bc3f932b Pick up Maven Moditect plugin version from parent POM bc3f932b is described below commit bc3f932b4478fc01c24719dace3d1ba6d71b0d92 Author: Gary Gregory AuthorDate: Fri Nov 10 12:35:16 2023 -0500 Pick up Maven Moditect plugin version from parent POM --- pom.xml | 1 - src/changes/changes.xml | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a783ed3a..bffea33d 100644 --- a/pom.xml +++ b/pom.xml @@ -253,7 +253,6 @@ true true true -1.0.0.Final ${commons.javadoc11.java.link} https://jakarta.ee/specifications/platform/9.1/apidocs/ diff --git a/src/changes/changes.xml b/src/changes/changes.xml index e3398336..64e50dee 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -50,6 +50,7 @@ The type attribute can be add,update,fix,remove. Fail fast on null inputs to org.apache.commons.fileupload2.core.AbstractRequestContext.AbstractRequestContext(Function, LongSupplier, T). Complete refactoring in JakartaServletRequestContext. Fix "Implicit narrowing conversion in compound assignment" from https://github.com/apache/commons-fileupload/security/code-scanning/118. + Pick up Maven Moditect plugin version from parent POM. Refactor to support Jakarta Servlet 5 and 6. Generate some OSGi metadata.
(commons-io) branch master updated: 2.15.0 breaks backwards compatibility in PathUtils.fileContentEquals for the Zip file system
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-io.git The following commit(s) were added to refs/heads/master by this push: new d6c14418 2.15.0 breaks backwards compatibility in PathUtils.fileContentEquals for the Zip file system d6c14418 is described below commit d6c14418c44fea1b783ec32ea683a78cacd6deec Author: Gary Gregory AuthorDate: Fri Nov 10 10:08:41 2023 -0500 2.15.0 breaks backwards compatibility in PathUtils.fileContentEquals for the Zip file system --- src/changes/changes.xml| 3 + .../java/org/apache/commons/io/file/PathUtils.java | 418 ++--- .../io/file/PathUtilsContentEqualsTest.java| 18 + .../commons/io/test-same-size-diff-contents.zip| Bin 0 -> 554 bytes 4 files changed, 229 insertions(+), 210 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 97d6583d..aaf21c71 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -117,6 +117,9 @@ The type attribute can be add,update,fix,remove. Pick up Maven Moditect plugin version from parent POM. + +2.15.0 breaks backwards compatibility in PathUtils.fileContentEquals for the Zip file system. + Add org.apache.commons.io.channels.FileChannels. diff --git a/src/main/java/org/apache/commons/io/file/PathUtils.java b/src/main/java/org/apache/commons/io/file/PathUtils.java index d85fdb67..6e3e4b1a 100644 --- a/src/main/java/org/apache/commons/io/file/PathUtils.java +++ b/src/main/java/org/apache/commons/io/file/PathUtils.java @@ -70,6 +70,7 @@ import java.util.stream.Stream; import org.apache.commons.io.Charsets; import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; +import org.apache.commons.io.IOUtils; import org.apache.commons.io.RandomAccessFileMode; import org.apache.commons.io.RandomAccessFiles; import org.apache.commons.io.ThreadUtils; @@ -87,8 +88,7 @@ import org.apache.commons.io.function.IOSupplier; public final class PathUtils { /** - * Private worker/holder that computes and tracks relative path names and their equality. We reuse the sorted relative - * lists when comparing directories. + * Private worker/holder that computes and tracks relative path names and their equality. We reuse the sorted relative lists when comparing directories. */ private static final class RelativeSortedPaths { @@ -101,15 +101,15 @@ public final class PathUtils { /** * Constructs and initializes a new instance by accumulating directory and file info. * - * @param dir1 First directory to compare. - * @param dir2 Seconds directory to compare. - * @param maxDepth See {@link Files#walkFileTree(Path,Set,int,FileVisitor)}. - * @param linkOptions Options indicating how symbolic links are handled. + * @param dir1 First directory to compare. + * @param dir2 Seconds directory to compare. + * @param maxDepth See {@link Files#walkFileTree(Path,Set,int,FileVisitor)}. + * @param linkOptions Options indicating how symbolic links are handled. * @param fileVisitOptions See {@link Files#walkFileTree(Path,Set,int,FileVisitor)}. * @throws IOException if an I/O error is thrown by a visitor method. */ private RelativeSortedPaths(final Path dir1, final Path dir2, final int maxDepth, final LinkOption[] linkOptions, -final FileVisitOption[] fileVisitOptions) throws IOException { +final FileVisitOption[] fileVisitOptions) throws IOException { final List tmpRelativeDirList1; final List tmpRelativeDirList2; List tmpRelativeFileList1 = null; @@ -148,9 +148,9 @@ public final class PathUtils { } } -private static final OpenOption[] OPEN_OPTIONS_TRUNCATE = {StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING}; +private static final OpenOption[] OPEN_OPTIONS_TRUNCATE = { StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING }; -private static final OpenOption[] OPEN_OPTIONS_APPEND = {StandardOpenOption.CREATE, StandardOpenOption.APPEND}; +private static final OpenOption[] OPEN_OPTIONS_APPEND = { StandardOpenOption.CREATE, StandardOpenOption.APPEND }; /** * Empty {@link CopyOption} array. @@ -190,7 +190,7 @@ public final class PathUtils { * @deprecated Use {@link #noFollowLinkOptionArray()}. */ @Deprecated -public static final LinkOption[] NOFOLLOW_LINK_OPTION_ARRAY = {LinkOption.NOFOLLOW_LINKS}; +public static final LinkOption[] NOFOLLOW_LINK_OPTION_ARRAY = { LinkOption.NOFOLLOW_LINKS }; /** * A LinkOption used to follow link in this class, the inverse of {@link
(commons-jexl) 01/01: Merge pull request #209 from apache/dependabot/maven/org.moditect-moditect-maven-plugin-1.1.0
This is an automated email from the ASF dual-hosted git repository. henrib pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-jexl.git commit 8a95dbe421c84eaaa659ed8b0637d46c84d2c1b2 Merge: fd86178a 3c61aefb Author: Henrib AuthorDate: Fri Nov 10 15:58:12 2023 +0100 Merge pull request #209 from apache/dependabot/maven/org.moditect-moditect-maven-plugin-1.1.0 Bump org.moditect:moditect-maven-plugin from 1.0.0.Final to 1.1.0 pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
(commons-jexl) branch master updated (fd86178a -> 8a95dbe4)
This is an automated email from the ASF dual-hosted git repository. henrib pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/commons-jexl.git from fd86178a JEXL: improve example on filter/map; keep inner classes close to usage to ease comprehension when reading code add 3c61aefb Bump org.moditect:moditect-maven-plugin from 1.0.0.Final to 1.1.0 new 8a95dbe4 Merge pull request #209 from apache/dependabot/maven/org.moditect-moditect-maven-plugin-1.1.0 The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
(commons-jexl) branch dependabot/maven/org.moditect-moditect-maven-plugin-1.1.0 deleted (was 3c61aefb)
This is an automated email from the ASF dual-hosted git repository. github-bot pushed a change to branch dependabot/maven/org.moditect-moditect-maven-plugin-1.1.0 in repository https://gitbox.apache.org/repos/asf/commons-jexl.git was 3c61aefb Bump org.moditect:moditect-maven-plugin from 1.0.0.Final to 1.1.0 The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(commons-io) branch master updated: Remove trailing whitespace
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-io.git The following commit(s) were added to refs/heads/master by this push: new a106199e Remove trailing whitespace a106199e is described below commit a106199e52d734ab05655144b382db272e3f2c6c Author: Gary Gregory AuthorDate: Fri Nov 10 09:37:49 2023 -0500 Remove trailing whitespace --- .../apache/commons/io/file/PathUtilsContentEqualsTest.java | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/test/java/org/apache/commons/io/file/PathUtilsContentEqualsTest.java b/src/test/java/org/apache/commons/io/file/PathUtilsContentEqualsTest.java index d8715fdd..696f37f9 100644 --- a/src/test/java/org/apache/commons/io/file/PathUtilsContentEqualsTest.java +++ b/src/test/java/org/apache/commons/io/file/PathUtilsContentEqualsTest.java @@ -167,28 +167,28 @@ public class PathUtilsContentEqualsTest { assertTrue(PathUtils.fileContentEquals(path1, path2)); assertTrue(PathUtils.fileContentEquals(path2, path2)); assertTrue(PathUtils.fileContentEquals(path2, path1)); - + // Directories assertThrows(IOException.class, () -> PathUtils.fileContentEquals(temporaryFolder.toPath(), temporaryFolder.toPath())); - + // Different files final Path objFile1 = Paths.get(temporaryFolder.getAbsolutePath(), getName() + ".object"); PathUtils.copyFile(getClass().getResource("/java/lang/Object.class"), objFile1); - + final Path objFile1b = Paths.get(temporaryFolder.getAbsolutePath(), getName() + ".object2"); PathUtils.copyFile(getClass().getResource("/java/lang/Object.class"), objFile1b); - + final Path objFile2 = Paths.get(temporaryFolder.getAbsolutePath(), getName() + ".collection"); PathUtils.copyFile(getClass().getResource("/java/util/Collection.class"), objFile2); - + assertFalse(PathUtils.fileContentEquals(objFile1, objFile2)); assertFalse(PathUtils.fileContentEquals(objFile1b, objFile2)); assertTrue(PathUtils.fileContentEquals(objFile1, objFile1b)); - + assertTrue(PathUtils.fileContentEquals(objFile1, objFile1)); assertTrue(PathUtils.fileContentEquals(objFile1b, objFile1b)); assertTrue(PathUtils.fileContentEquals(objFile2, objFile2)); - + // Equal files Files.createFile(path1); Files.createFile(path2);
(commons-io) branch master updated: Test PathUtils.fileContentEquals(Path, Path) with zip files
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-io.git The following commit(s) were added to refs/heads/master by this push: new de0a108b Test PathUtils.fileContentEquals(Path, Path) with zip files de0a108b is described below commit de0a108b8d44a0c98dcfda791f75f5084262a5c9 Author: Gary Gregory AuthorDate: Fri Nov 10 09:30:46 2023 -0500 Test PathUtils.fileContentEquals(Path, Path) with zip files --- src/test/java/org/apache/commons/io/file/PathUtilsContentEqualsTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/java/org/apache/commons/io/file/PathUtilsContentEqualsTest.java b/src/test/java/org/apache/commons/io/file/PathUtilsContentEqualsTest.java index b094d35e..d8715fdd 100644 --- a/src/test/java/org/apache/commons/io/file/PathUtilsContentEqualsTest.java +++ b/src/test/java/org/apache/commons/io/file/PathUtilsContentEqualsTest.java @@ -198,7 +198,6 @@ public class PathUtilsContentEqualsTest { @Test public void testFileContentEqualsZip() throws Exception { -// Non-existent files final Path path1 = Paths.get("src/test/resources/org/apache/commons/io/bla.zip"); final Path path2 = Paths.get("src/test/resources/org/apache/commons/io/bla-copy.zip"); final Path path3 = Paths.get("src/test/resources/org/apache/commons/io/moby.zip");
(commons-io) branch master updated: Test PathUtils.fileContentEquals(Path, Path) with zip files
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-io.git The following commit(s) were added to refs/heads/master by this push: new 196ab82c Test PathUtils.fileContentEquals(Path, Path) with zip files 196ab82c is described below commit 196ab82c1aabf334edcae29ccd70c998c38057f6 Author: Gary Gregory AuthorDate: Fri Nov 10 09:29:32 2023 -0500 Test PathUtils.fileContentEquals(Path, Path) with zip files --- .../io/file/PathUtilsContentEqualsTest.java| 24 +++-- .../resources/org/apache/commons/io/bla-copy.zip | Bin 0 -> 666 bytes src/test/resources/org/apache/commons/io/bla.zip | Bin 0 -> 666 bytes src/test/resources/org/apache/commons/io/moby.zip | Bin 0 -> 4897 bytes 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/test/java/org/apache/commons/io/file/PathUtilsContentEqualsTest.java b/src/test/java/org/apache/commons/io/file/PathUtilsContentEqualsTest.java index 13ea17f2..b094d35e 100644 --- a/src/test/java/org/apache/commons/io/file/PathUtilsContentEqualsTest.java +++ b/src/test/java/org/apache/commons/io/file/PathUtilsContentEqualsTest.java @@ -167,28 +167,28 @@ public class PathUtilsContentEqualsTest { assertTrue(PathUtils.fileContentEquals(path1, path2)); assertTrue(PathUtils.fileContentEquals(path2, path2)); assertTrue(PathUtils.fileContentEquals(path2, path1)); - + // Directories assertThrows(IOException.class, () -> PathUtils.fileContentEquals(temporaryFolder.toPath(), temporaryFolder.toPath())); - + // Different files final Path objFile1 = Paths.get(temporaryFolder.getAbsolutePath(), getName() + ".object"); PathUtils.copyFile(getClass().getResource("/java/lang/Object.class"), objFile1); - + final Path objFile1b = Paths.get(temporaryFolder.getAbsolutePath(), getName() + ".object2"); PathUtils.copyFile(getClass().getResource("/java/lang/Object.class"), objFile1b); - + final Path objFile2 = Paths.get(temporaryFolder.getAbsolutePath(), getName() + ".collection"); PathUtils.copyFile(getClass().getResource("/java/util/Collection.class"), objFile2); - + assertFalse(PathUtils.fileContentEquals(objFile1, objFile2)); assertFalse(PathUtils.fileContentEquals(objFile1b, objFile2)); assertTrue(PathUtils.fileContentEquals(objFile1, objFile1b)); - + assertTrue(PathUtils.fileContentEquals(objFile1, objFile1)); assertTrue(PathUtils.fileContentEquals(objFile1b, objFile1b)); assertTrue(PathUtils.fileContentEquals(objFile2, objFile2)); - + // Equal files Files.createFile(path1); Files.createFile(path2); @@ -196,4 +196,14 @@ public class PathUtilsContentEqualsTest { assertTrue(PathUtils.fileContentEquals(path1, path2)); } +@Test +public void testFileContentEqualsZip() throws Exception { +// Non-existent files +final Path path1 = Paths.get("src/test/resources/org/apache/commons/io/bla.zip"); +final Path path2 = Paths.get("src/test/resources/org/apache/commons/io/bla-copy.zip"); +final Path path3 = Paths.get("src/test/resources/org/apache/commons/io/moby.zip"); +assertTrue(PathUtils.fileContentEquals(path1, path2)); +assertFalse(PathUtils.fileContentEquals(path1, path3)); +} + } diff --git a/src/test/resources/org/apache/commons/io/bla-copy.zip b/src/test/resources/org/apache/commons/io/bla-copy.zip new file mode 100644 index ..160eedc6 Binary files /dev/null and b/src/test/resources/org/apache/commons/io/bla-copy.zip differ diff --git a/src/test/resources/org/apache/commons/io/bla.zip b/src/test/resources/org/apache/commons/io/bla.zip new file mode 100644 index ..160eedc6 Binary files /dev/null and b/src/test/resources/org/apache/commons/io/bla.zip differ diff --git a/src/test/resources/org/apache/commons/io/moby.zip b/src/test/resources/org/apache/commons/io/moby.zip new file mode 100644 index ..ae3f9ee6 Binary files /dev/null and b/src/test/resources/org/apache/commons/io/moby.zip differ
(commons-io) branch dependabot/maven/org.moditect-moditect-maven-plugin-1.1.0 deleted (was 100515bb)
This is an automated email from the ASF dual-hosted git repository. github-bot pushed a change to branch dependabot/maven/org.moditect-moditect-maven-plugin-1.1.0 in repository https://gitbox.apache.org/repos/asf/commons-io.git was 100515bb Bump org.moditect:moditect-maven-plugin from 1.0.0.Final to 1.1.0 The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(commons-io) branch master updated: Pick up Maven Moditect plugin version from parent POM
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-io.git The following commit(s) were added to refs/heads/master by this push: new 8aa04184 Pick up Maven Moditect plugin version from parent POM 8aa04184 is described below commit 8aa04184f63ed7e14bd7f8500265a3a85120ea17 Author: Gary Gregory AuthorDate: Fri Nov 10 09:10:12 2023 -0500 Pick up Maven Moditect plugin version from parent POM --- pom.xml | 1 - src/changes/changes.xml | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4ee70d48..c182a320 100644 --- a/pom.xml +++ b/pom.xml @@ -344,7 +344,6 @@ file comparators, endian transformation classes, and much more. https://svn.apache.org/repos/infra/websites/production/commons/content/proper/commons-io/ site-content ${commons.javadoc8.java.link} -1.0.0.Final 1.37 1.14.9 false diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 1d5e1bf8..97d6583d 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -114,6 +114,9 @@ The type attribute can be add,update,fix,remove. UnsynchronizedBufferedInputStream.read(byte[], int, int) does not use buffer. + +Pick up Maven Moditect plugin version from parent POM. + Add org.apache.commons.io.channels.FileChannels.
(commons-compress) branch master updated: [COMPRESS-632] LZWInputStream.initializeTables(int) should throw IllegalArgumentException instead of ArrayIndexOutOfBoundsException #435
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 ac6cfa45e [COMPRESS-632] LZWInputStream.initializeTables(int) should throw IllegalArgumentException instead of ArrayIndexOutOfBoundsException #435 ac6cfa45e is described below commit ac6cfa45e457227e49d66e4670453abf812e5608 Author: Gary Gregory AuthorDate: Fri Nov 10 08:50:57 2023 -0500 [COMPRESS-632] LZWInputStream.initializeTables(int) should throw IllegalArgumentException instead of ArrayIndexOutOfBoundsException #435 Apply a different version of PR #435 from Yakov Shafranovich --- .../org/apache/commons/compress/compressors/lzw/LZWInputStream.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java b/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java index acaba7711..68c898ea1 100644 --- a/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java +++ b/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java @@ -206,7 +206,7 @@ public abstract class LZWInputStream extends CompressorInputStream implements In if (memoryLimitInKb > -1) { final int maxTableSize = 1 << maxCodeSize; //account for potential overflow -final long memoryUsageInBytes = (long) maxTableSize * 6;//(4 (prefixes) + 1 (characters) +1 (outputStack)) +final long memoryUsageInBytes = (long) maxTableSize * 6; //(4 (prefixes) + 1 (characters) +1 (outputStack)) final long memoryUsageInKb = memoryUsageInBytes >> 10; if (memoryUsageInKb > memoryLimitInKb) {
(commons-compress) branch master updated: [COMPRESS-632] LZWInputStream.initializeTables(int) should throw IllegalArgumentException instead of ArrayIndexOutOfBoundsException #435
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 3e542a8bf [COMPRESS-632] LZWInputStream.initializeTables(int) should throw IllegalArgumentException instead of ArrayIndexOutOfBoundsException #435 3e542a8bf is described below commit 3e542a8bf86ca707b91fb201531f78ed7e173519 Author: Gary Gregory AuthorDate: Fri Nov 10 08:50:01 2023 -0500 [COMPRESS-632] LZWInputStream.initializeTables(int) should throw IllegalArgumentException instead of ArrayIndexOutOfBoundsException #435 Apply a different version of PR #435 from Yakov Shafranovich --- .../java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java b/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java index 05455ee06..acaba7711 100644 --- a/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java +++ b/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java @@ -172,6 +172,7 @@ public abstract class LZWInputStream extends CompressorInputStream implements In // maxCodeSize shifted cannot be less than 256, otherwise the loop in initializeTables() will throw an ArrayIndexOutOfBoundsException // maxCodeSize cannot be smaller than getCodeSize(), otherwise addEntry() will throw an ArrayIndexOutOfBoundsException if (1 << maxCodeSize < 256 || getCodeSize() > maxCodeSize) { +// TODO test against prefixes.length and characters.length? throw new IllegalArgumentException("maxCodeSize " + maxCodeSize + " is out of bounds."); } final int maxTableSize = 1 << maxCodeSize;
(commons-compress) branch master updated: [COMPRESS-632] LZWInputStream.initializeTables(int) should throw IllegalArgumentException instead of ArrayIndexOutOfBoundsException #435
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 787f44c83 [COMPRESS-632] LZWInputStream.initializeTables(int) should throw IllegalArgumentException instead of ArrayIndexOutOfBoundsException #435 787f44c83 is described below commit 787f44c83e84e308c174c46a3c4017326fe7f8f3 Author: Gary Gregory AuthorDate: Fri Nov 10 08:48:51 2023 -0500 [COMPRESS-632] LZWInputStream.initializeTables(int) should throw IllegalArgumentException instead of ArrayIndexOutOfBoundsException #435 Apply a different version of PR #435 from Yakov Shafranovich --- .../org/apache/commons/compress/compressors/lzw/LZWInputStream.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java b/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java index b51e4b47a..6917ccef1 100644 --- a/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java +++ b/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java @@ -172,7 +172,7 @@ public abstract class LZWInputStream extends CompressorInputStream implements In // maxCodeSize shifted cannot be less than 256, otherwise the loop in initializeTables() will throw an ArrayIndexOutOfBoundsException // maxCodeSize cannot be smaller than getCodeSize(), otherwise addEntry() will throw an ArrayIndexOutOfBoundsException if (1 << maxCodeSize < 256 || getCodeSize() > maxCodeSize) { -throw new IllegalArgumentException("maxCodeSize is " + maxCodeSize + ", must be bigger than 0"); +throw new IllegalArgumentException("maxCodeSize is " + maxCodeSize + ", is out of bounds."); } final int maxTableSize = 1 << maxCodeSize; prefixes = new int[maxTableSize];
(commons-compress) branch master updated: [COMPRESS-632] LZWInputStream.initializeTables(int) should throw IllegalArgumentException instead of ArrayIndexOutOfBoundsException #435
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 b8804c974 [COMPRESS-632] LZWInputStream.initializeTables(int) should throw IllegalArgumentException instead of ArrayIndexOutOfBoundsException #435 b8804c974 is described below commit b8804c974eae232beb9470a3fcb7bcddac32ff2c Author: Gary Gregory AuthorDate: Fri Nov 10 08:49:11 2023 -0500 [COMPRESS-632] LZWInputStream.initializeTables(int) should throw IllegalArgumentException instead of ArrayIndexOutOfBoundsException #435 Apply a different version of PR #435 from Yakov Shafranovich --- .../org/apache/commons/compress/compressors/lzw/LZWInputStream.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java b/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java index 6917ccef1..05455ee06 100644 --- a/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java +++ b/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java @@ -172,7 +172,7 @@ public abstract class LZWInputStream extends CompressorInputStream implements In // maxCodeSize shifted cannot be less than 256, otherwise the loop in initializeTables() will throw an ArrayIndexOutOfBoundsException // maxCodeSize cannot be smaller than getCodeSize(), otherwise addEntry() will throw an ArrayIndexOutOfBoundsException if (1 << maxCodeSize < 256 || getCodeSize() > maxCodeSize) { -throw new IllegalArgumentException("maxCodeSize is " + maxCodeSize + ", is out of bounds."); +throw new IllegalArgumentException("maxCodeSize " + maxCodeSize + " is out of bounds."); } final int maxTableSize = 1 << maxCodeSize; prefixes = new int[maxTableSize];
(commons-compress) branch master updated: [COMPRESS-632] LZWInputStream.initializeTables(int) should throw IllegalArgumentException instead of ArrayIndexOutOfBoundsException #435
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 e0f21a499 [COMPRESS-632] LZWInputStream.initializeTables(int) should throw IllegalArgumentException instead of ArrayIndexOutOfBoundsException #435 e0f21a499 is described below commit e0f21a4996738e0275db0d6ba38cf51b07a711a0 Author: Gary Gregory AuthorDate: Fri Nov 10 08:47:28 2023 -0500 [COMPRESS-632] LZWInputStream.initializeTables(int) should throw IllegalArgumentException instead of ArrayIndexOutOfBoundsException #435 Apply a different version of PR #435 from Yakov Shafranovich --- src/changes/changes.xml| 1 + .../compress/compressors/lzw/LZWInputStream.java | 10 --- .../compressors/z/ZCompressorInputStreamTest.java | 34 -- 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 6448265ed..412805e02 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -86,6 +86,7 @@ The type attribute can be add,update,fix,remove. Use the root Locale for string conversion of command line options in org.apache.commons.compress.archivers.sevenz.CLI. Calling PackingUtils.config(PackingOptions) with null now closes the internal FileHandler. LZ4 compressor throws IndexOutOfBoundsException. + LZWInputStream.initializeTables(int) should throw IllegalArgumentException instead of ArrayIndexOutOfBoundsException. Bump org.slf4j:slf4j-api from 2.0.8 to 2.0.9 #413. Bump commons-io:commons-io from 2.13.0 to 2.15.0. diff --git a/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java b/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java index cad2a2bba..b51e4b47a 100644 --- a/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java +++ b/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java @@ -164,13 +164,15 @@ public abstract class LZWInputStream extends CompressorInputStream implements In /** * Initializes the arrays based on the maximum code size. + * * @param maxCodeSize maximum code size - * @throws IllegalArgumentException if {@code maxCodeSize} is not bigger than 0 + * @throws IllegalArgumentException if {@code maxCodeSize} is out of bounds for {@code prefixes} and {@code characters}. */ protected void initializeTables(final int maxCodeSize) { -if (maxCodeSize <= 0) { -throw new IllegalArgumentException("maxCodeSize is " + maxCodeSize -+ ", must be bigger than 0"); +// maxCodeSize shifted cannot be less than 256, otherwise the loop in initializeTables() will throw an ArrayIndexOutOfBoundsException +// maxCodeSize cannot be smaller than getCodeSize(), otherwise addEntry() will throw an ArrayIndexOutOfBoundsException +if (1 << maxCodeSize < 256 || getCodeSize() > maxCodeSize) { +throw new IllegalArgumentException("maxCodeSize is " + maxCodeSize + ", must be bigger than 0"); } final int maxTableSize = 1 << maxCodeSize; prefixes = new int[maxTableSize]; diff --git a/src/test/java/org/apache/commons/compress/compressors/z/ZCompressorInputStreamTest.java b/src/test/java/org/apache/commons/compress/compressors/z/ZCompressorInputStreamTest.java index 793360f05..450909205 100644 --- a/src/test/java/org/apache/commons/compress/compressors/z/ZCompressorInputStreamTest.java +++ b/src/test/java/org/apache/commons/compress/compressors/z/ZCompressorInputStreamTest.java @@ -18,17 +18,20 @@ */ package org.apache.commons.compress.compressors.z; -import static org.apache.commons.compress.AbstractTest.getFile; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; +import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.SequenceInputStream; import java.nio.file.Files; import java.util.Collections; +import java.util.stream.IntStream; +import java.util.stream.Stream; +import org.apache.commons.compress.AbstractTest; import org.apache.commons.compress.utils.IOUtils; import org.junit.jupiter.api.Test; @@ -45,9 +48,34 @@ public class ZCompressorInputStreamTest { assertThrows(IOException.class, () -> new ZCompressorInputStream(sequenceInputStream)); } +@Test +public void testInvalidMaxCodeSize() throws IOException { +final byte[] bytes = Files.readAllBytes(AbstractTest.getPath("bla.tar.Z")); + +// @formatter:off +final IntStream[] invalid = { +IntStream.range(Byte.MIN_VALUE, -120), +IntStream.range(-97,
(commons-jexl) branch dependabot/maven/org.moditect-moditect-maven-plugin-1.1.0 created (now 3c61aefb)
This is an automated email from the ASF dual-hosted git repository. github-bot pushed a change to branch dependabot/maven/org.moditect-moditect-maven-plugin-1.1.0 in repository https://gitbox.apache.org/repos/asf/commons-jexl.git at 3c61aefb Bump org.moditect:moditect-maven-plugin from 1.0.0.Final to 1.1.0 No new revisions were added by this update.
(commons-parent) branch master updated: Bump failsafe and surefire from 3.2.1 to 3.2.2
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-parent.git The following commit(s) were added to refs/heads/master by this push: new 0aabe07 Bump failsafe and surefire from 3.2.1 to 3.2.2 0aabe07 is described below commit 0aabe079770765f665354edbbafe0497e84dd1f4 Author: Gary Gregory AuthorDate: Fri Nov 10 07:04:18 2023 -0500 Bump failsafe and surefire from 3.2.1 to 3.2.2 - Bump maven-failsafe-plugin from 3.2.1 to 3.2.2 - Bump maven-surefire-plugin from 3.2.1 to 3.2.2 - Bump maven-surefire-report-plugin from 3.2.1 to 3.2.2 --- pom.xml | 6 +++--- src/changes/changes.xml | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index c46a903..cfe6c6a 100644 --- a/pom.xml +++ b/pom.xml @@ -147,7 +147,7 @@ 3.11.0 2.7.10 0.7.0 -3.2.1 +3.2.2 5.1.9 0.8.11 0.18.3 @@ -206,8 +206,8 @@ 3.12.1 4.8.1.0 4.8.1 -3.2.1 -3.2.1 +3.2.2 +3.2.2 3.5.3 diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 8a16747..bc42ec4 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -79,6 +79,9 @@ The type attribute can be add,update,fix,remove. Bump JUnit from 5.10.0 to 5.10.1. Bump org.moditect:moditect-maven-plugin from 1.0.0.Final to 1.1.0. Bump com.github.spotbugs:spotbugs-maven-plugin from 4.7.3.6 to 4.8.1.0. + Bump maven-failsafe-plugin from 3.2.1 to 3.2.2. + Bump maven-surefire-plugin from 3.2.1 to 3.2.2. + Bump maven-surefire-report-plugin from 3.2.1 to 3.2.2.
(commons-parent) branch dependabot/maven/com.github.spotbugs-spotbugs-maven-plugin-4.8.1.0 deleted (was ebef1bb)
This is an automated email from the ASF dual-hosted git repository. github-bot pushed a change to branch dependabot/maven/com.github.spotbugs-spotbugs-maven-plugin-4.8.1.0 in repository https://gitbox.apache.org/repos/asf/commons-parent.git was ebef1bb Bump com.github.spotbugs:spotbugs-maven-plugin from 4.7.3.6 to 4.8.1.0 The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(commons-parent) branch master updated: Bump com.github.spotbugs:spotbugs-maven-plugin from 4.7.3.6 to 4.8.1.0
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-parent.git The following commit(s) were added to refs/heads/master by this push: new 13ddfbe Bump com.github.spotbugs:spotbugs-maven-plugin from 4.7.3.6 to 4.8.1.0 13ddfbe is described below commit 13ddfbe0798c1f6b49fb5ba335ed4a1136dcaa46 Author: Gary Gregory AuthorDate: Fri Nov 10 06:59:13 2023 -0500 Bump com.github.spotbugs:spotbugs-maven-plugin from 4.7.3.6 to 4.8.1.0 --- pom.xml | 2 +- src/changes/changes.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 359f526..c46a903 100644 --- a/pom.xml +++ b/pom.xml @@ -204,7 +204,7 @@ Warning: maven-site-plugin 4.0.0-M3 requires an update to commons-skin site.vm for new variable names. --> 3.12.1 -4.7.3.6 +4.8.1.0 4.8.1 3.2.1 3.2.1 diff --git a/src/changes/changes.xml b/src/changes/changes.xml index caf515f..8a16747 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -78,6 +78,7 @@ The type attribute can be add,update,fix,remove. Bump maven-javadoc-plugin from 3.6.0 to 3.6.2. Bump JUnit from 5.10.0 to 5.10.1. Bump org.moditect:moditect-maven-plugin from 1.0.0.Final to 1.1.0. + Bump com.github.spotbugs:spotbugs-maven-plugin from 4.7.3.6 to 4.8.1.0.
(commons-parent) branch dependabot/maven/org.moditect-moditect-maven-plugin-1.1.0 deleted (was 5a043d7)
This is an automated email from the ASF dual-hosted git repository. github-bot pushed a change to branch dependabot/maven/org.moditect-moditect-maven-plugin-1.1.0 in repository https://gitbox.apache.org/repos/asf/commons-parent.git was 5a043d7 Bump org.moditect:moditect-maven-plugin from 1.0.0.Final to 1.1.0 The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(commons-parent) branch master updated: org.moditect:moditect-maven-plugin from 1.0.0.Final to 1.1.0
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-parent.git The following commit(s) were added to refs/heads/master by this push: new fd1adff org.moditect:moditect-maven-plugin from 1.0.0.Final to 1.1.0 fd1adff is described below commit fd1adff1373fbd169525389315198e990e06e3b2 Author: Gary Gregory AuthorDate: Fri Nov 10 06:51:33 2023 -0500 org.moditect:moditect-maven-plugin from 1.0.0.Final to 1.1.0 --- pom.xml | 2 +- src/changes/changes.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8138daa..359f526 100644 --- a/pom.xml +++ b/pom.xml @@ -161,7 +161,7 @@ 1.8.1 1.1 3.2.0 - 1.0.0.Final + 1.1.0 true 6.4.1 5.10.1 diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 8f936a5..caf515f 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -77,6 +77,7 @@ The type attribute can be add,update,fix,remove. Bump maven-pmd-plugin from 3.21.0 to 3.21.2. Bump maven-javadoc-plugin from 3.6.0 to 3.6.2. Bump JUnit from 5.10.0 to 5.10.1. + Bump org.moditect:moditect-maven-plugin from 1.0.0.Final to 1.1.0.
(commons-parent) branch dependabot/maven/org.moditect-moditect-maven-plugin-1.1.0 created (now 5a043d7)
This is an automated email from the ASF dual-hosted git repository. github-bot pushed a change to branch dependabot/maven/org.moditect-moditect-maven-plugin-1.1.0 in repository https://gitbox.apache.org/repos/asf/commons-parent.git at 5a043d7 Bump org.moditect:moditect-maven-plugin from 1.0.0.Final to 1.1.0 No new revisions were added by this update.
(commons-parent) branch dependabot/maven/com.github.spotbugs-spotbugs-maven-plugin-4.8.1.0 created (now ebef1bb)
This is an automated email from the ASF dual-hosted git repository. github-bot pushed a change to branch dependabot/maven/com.github.spotbugs-spotbugs-maven-plugin-4.8.1.0 in repository https://gitbox.apache.org/repos/asf/commons-parent.git at ebef1bb Bump com.github.spotbugs:spotbugs-maven-plugin from 4.7.3.6 to 4.8.1.0 No new revisions were added by this update.
(commons-crypto) branch dependabot/github_actions/docker/setup-qemu-action-3.0.0 created (now 430874be)
This is an automated email from the ASF dual-hosted git repository. github-bot pushed a change to branch dependabot/github_actions/docker/setup-qemu-action-3.0.0 in repository https://gitbox.apache.org/repos/asf/commons-crypto.git at 430874be Bump docker/setup-qemu-action from 2.2.0 to 3.0.0 No new revisions were added by this update.
(commons-logging) branch dependabot/maven/logback.version-1.4.11 created (now a4896b6)
This is an automated email from the ASF dual-hosted git repository. github-bot pushed a change to branch dependabot/maven/logback.version-1.4.11 in repository https://gitbox.apache.org/repos/asf/commons-logging.git at a4896b6 Bump logback.version from 1.3.11 to 1.4.11 No new revisions were added by this update.