Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade commons-io from 2.15.1 to 2.16.1 #513

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

madrob
Copy link
Contributor

@madrob madrob commented Apr 6, 2024

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

Also closes #505

@codecov-commenter
Copy link

codecov-commenter commented Apr 6, 2024

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 ⚠️
...ommons/compress/archivers/zip/ZipArchiveEntry.java 0.00% 0 Missing and 1 partial ⚠️
...a/org/apache/commons/compress/utils/TimeUtils.java 80.00% 1 Missing ⚠️
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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@garydgregory
Copy link
Member

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

@garydgregory
Copy link
Member

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

@madrob madrob marked this pull request as ready for review April 23, 2024 19:27
@garydgregory
Copy link
Member

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

@garydgregory
Copy link
Member

@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
Copy link
Member

@madrob
Would you please rebase on git master?

@garydgregory
Copy link
Member

@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.

asfgit pushed a commit that referenced this pull request Jun 28, 2024
- Migrate to non-deprecated code
- Thanks to madrob Mike Drob and PR 513
- https://github.com/apache/commons-compress/pull/513/files
asfgit pushed a commit that referenced this pull request Jun 28, 2024
- Migrate to non-deprecated code
- Thanks to madrob Mike Drob and PR 513
- https://github.com/apache/commons-compress/pull/513/files
asfgit pushed a commit that referenced this pull request Jun 28, 2024
- Migrate to non-deprecated code
- Thanks to madrob Mike Drob and PR 513
- https://github.com/apache/commons-compress/pull/513/files
asfgit pushed a commit that referenced this pull request Jun 28, 2024
- Migrate to non-deprecated code
- Thanks to madrob Mike Drob and PR 513
- https://github.com/apache/commons-compress/pull/513/files
asfgit pushed a commit that referenced this pull request Jun 28, 2024
- Migrate to non-deprecated code
- Thanks to madrob Mike Drob and PR 513
- https://github.com/apache/commons-compress/pull/513/files
asfgit pushed a commit that referenced this pull request Jun 28, 2024
- Migrate to non-deprecated code
- Thanks to madrob Mike Drob and PR 513
- https://github.com/apache/commons-compress/pull/513/files
asfgit pushed a commit that referenced this pull request Jun 28, 2024
- Migrate to non-deprecated code
- Thanks to madrob Mike Drob and PR 513
- https://github.com/apache/commons-compress/pull/513/files
asfgit pushed a commit that referenced this pull request Jun 28, 2024
- Migrate to non-deprecated code
- Thanks to madrob Mike Drob and PR 513
- https://github.com/apache/commons-compress/pull/513/files
asfgit pushed a commit that referenced this pull request Jun 28, 2024
- Migrate to non-deprecated code
- Thanks to madrob Mike Drob and PR 513
- https://github.com/apache/commons-compress/pull/513/files
asfgit pushed a commit that referenced this pull request Jun 28, 2024
- Migrate to non-deprecated code
- Thanks to madrob Mike Drob and PR 513
- https://github.com/apache/commons-compress/pull/513/files
asfgit pushed a commit that referenced this pull request Jun 28, 2024
- Migrate to non-deprecated code
- Thanks to madrob Mike Drob and PR 513
- https://github.com/apache/commons-compress/pull/513/files
asfgit pushed a commit that referenced this pull request Jun 28, 2024
- Migrate to non-deprecated code
- Thanks to madrob Mike Drob and PR 513
- https://github.com/apache/commons-compress/pull/513/files
asfgit pushed a commit that referenced this pull request Jun 28, 2024
- Migrate to non-deprecated code
- Thanks to madrob Mike Drob and PR 513
- https://github.com/apache/commons-compress/pull/513/files
asfgit pushed a commit that referenced this pull request Jun 28, 2024
- Migrate to non-deprecated code
- Thanks to madrob Mike Drob and PR 513
- https://github.com/apache/commons-compress/pull/513/files
@garydgregory
Copy link
Member

@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
Copy link
Member

@madrob ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants