commons-compress icon indicating copy to clipboard operation
commons-compress copied to clipboard

Upgrade commons-io from 2.15.1 to 2.16.1

Open madrob opened this issue 1 year ago • 8 comments

Currently uses the snapshot version, can update to full release when that is available.

Also closes #505

madrob avatar Apr 06 '24 02:04 madrob

Codecov Report

Attention: Patch coverage is 93.58974% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 80.73%. Comparing base (1887b3d) to head (caf4158). Report is 225 commits behind head on master.

Files Patch % Lines
.../commons/compress/archivers/sevenz/SevenZFile.java 92.50% 0 Missing and 3 partials :warning:
...ommons/compress/archivers/zip/ZipArchiveEntry.java 0.00% 0 Missing and 1 partial :warning:
...a/org/apache/commons/compress/utils/TimeUtils.java 80.00% 1 Missing :warning:
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #513      +/-   ##
============================================
- Coverage     80.76%   80.73%   -0.04%     
- Complexity     6801     6828      +27     
============================================
  Files           348      348              
  Lines         24945    25051     +106     
  Branches       4029     4035       +6     
============================================
+ Hits          20148    20224      +76     
- Misses         3269     3296      +27     
- Partials       1528     1531       +3     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Apr 06 '24 02:04 codecov-commenter

@madrob Thank you for the PR. Please run mvn by itself to run the default Maven goal and catch all build errors.

garydgregory avatar Apr 06 '24 02:04 garydgregory

@madrob I think we need to address https://issues.apache.org/jira/browse/COMPRESS-675 before this PR. Any thoughts?

garydgregory avatar Apr 06 '24 02:04 garydgregory

@madrob I had to fix a couple of bugs, please rebase on git master. TY!

garydgregory avatar May 16 '24 11:05 garydgregory

@madrob I had to fix a couple of bugs, please rebase on git master. TY!

https://issues.apache.org/jira/browse/COMPRESS-675 has been addressed.

garydgregory avatar Jun 04 '24 13:06 garydgregory

@madrob Would you please rebase on git master?

garydgregory avatar Jun 04 '24 13:06 garydgregory

@madrob Thank you for your update. I'm going to bring this in as smaller chunks to make any regressions easier to bisect on a per-format basis.

garydgregory avatar Jun 28 '24 20:06 garydgregory

@madrob

I've brought in most of this PR in several commits. If you rebase on git master, you should see the following remaining changes which are not merged:

diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
index b138c4e..aef689a 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
@@ -37,8 +37,8 @@
 import org.apache.commons.compress.archivers.zip.ZipEncoding;
 import org.apache.commons.compress.archivers.zip.ZipEncodingHelper;
 import org.apache.commons.compress.utils.ArchiveUtils;
-import org.apache.commons.compress.utils.BoundedInputStream;
 import org.apache.commons.compress.utils.IOUtils;
+import org.apache.commons.io.input.BoundedInputStream;
 
 /**
  * The TarInputStream reads a UNIX tar archive as an InputStream. methods are provided to position at each successive entry in the archive, and the read each
diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java
index fb0ca76..c054cef 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java
@@ -36,9 +36,9 @@
 import org.apache.commons.compress.archivers.zip.ZipEncodingHelper;
 import org.apache.commons.compress.utils.ArchiveUtils;
 import org.apache.commons.compress.utils.BoundedArchiveInputStream;
-import org.apache.commons.compress.utils.BoundedInputStream;
 import org.apache.commons.compress.utils.BoundedSeekableByteChannelInputStream;
 import org.apache.commons.compress.utils.SeekableInMemoryByteChannel;
+import org.apache.commons.io.input.BoundedInputStream;
 
 /**
  * Provides random access to UNIX archives.
diff --git a/src/main/java/org/apache/commons/compress/harmony/unpack200/Archive.java b/src/main/java/org/apache/commons/compress/harmony/unpack200/Archive.java
index d134a65..967c77e 100644
--- a/src/main/java/org/apache/commons/compress/harmony/unpack200/Archive.java
+++ b/src/main/java/org/apache/commons/compress/harmony/unpack200/Archive.java
@@ -70,7 +70,7 @@
      * Creates an Archive with streams for the input and output files. Note: If you use this method then calling {@link #setRemovePackFile(boolean)} will have
      * no effect.
      *
-     * @param inputStream  the input stream, preferably a {@link BoundedInputStream}. The bound can the the file size.
+     * @param inputStream  the input stream, preferably a {@link BoundedInputStream}. The bound can be the file size.
      * @param outputStream the JAR output stream.
      * @throws IOException if an I/O error occurs
      */
@@ -99,7 +99,7 @@
     public Archive(final String inputFileName, final String outputFileName) throws FileNotFoundException, IOException {
         this.inputPath = Paths.get(inputFileName);
         this.inputSize = Files.size(this.inputPath);
-        this.inputStream = new BoundedInputStream(Files.newInputStream(inputPath), inputSize);
+        this.inputStream = BoundedInputStream.builder().setPath(inputPath).setMaxCount(inputSize).get();
         this.outputStream = new JarOutputStream(new BufferedOutputStream(new FileOutputStream(outputFileName)));
         this.outputFileName = outputFileName;
         this.closeStreams = true;

I'm not sure these are correct as they propagate stream closure instead of called setPropagateClose(false). This likely means we are missing some unit tests. WDYT?

garydgregory avatar Jun 28 '24 20:06 garydgregory

@madrob ?

garydgregory avatar Jul 13 '24 12:07 garydgregory

Closing: No more feedback; mostly done in git master.

garydgregory avatar Oct 09 '24 19:10 garydgregory