You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/10/29 12:35:04 UTC

(commons-compress) branch master updated: Private class ZipFile.BoundedFileChannelInputStream should be a static inner class

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 b7c16ee0 Private class ZipFile.BoundedFileChannelInputStream should be a static inner class
b7c16ee0 is described below

commit b7c16ee0e7b640d430f62b110d34f5ad8a7493c4
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Oct 29 08:34:59 2023 -0400

    Private class ZipFile.BoundedFileChannelInputStream should be a static
    inner class
---
 src/changes/changes.xml                                          | 1 +
 .../java/org/apache/commons/compress/archivers/zip/ZipFile.java  | 9 +++++----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index b4960612..90cac017 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -75,6 +75,7 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Incorrect string comparison in unpack200.AttributeLayout.numBackwardsCallables().</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Inefficient use of keySet iterator instead of entrySet iterator in pack200.PackingOptions.addOrUpdateAttributeActions(List, Map, int).</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Package private class pack200.IcBands.IcTuple should be a static inner class.</action>
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">Private class ZipFile.BoundedFileChannelInputStream should be a static inner class.</action>
       <!-- UPDATE -->
       <action type="update" dev="ggregory" due-to="Dependabot">Bump org.slf4j:slf4j-api from 2.0.8 to 2.0.9 #413.</action>
       <action type="update" dev="ggregory" due-to="Gary Gregory">Bump commons-io:commons-io from 2.13.0 to 2.15.0.</action>
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
index a2496c8d..10fb63d8 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
@@ -82,18 +82,19 @@ import org.apache.commons.compress.utils.InputStreamStatistics;
  * </ul>
  */
 public class ZipFile implements Closeable {
+
     /**
      * Lock-free implementation of BoundedInputStream. The
      * implementation uses positioned reads on the underlying archive
      * file channel and therefore performs significantly faster in
      * concurrent environment.
      */
-    private class BoundedFileChannelInputStream extends BoundedArchiveInputStream {
+    private static class BoundedFileChannelInputStream extends BoundedArchiveInputStream {
         private final FileChannel archive;
 
-        BoundedFileChannelInputStream(final long start, final long remaining) {
+        BoundedFileChannelInputStream(final long start, final long remaining, final FileChannel archive) {
             super(start, remaining);
-            archive = (FileChannel) ZipFile.this.archive;
+            this.archive = archive;
         }
 
         @Override
@@ -786,7 +787,7 @@ public class ZipFile implements Closeable {
                 + " are out of range");
         }
         return archive instanceof FileChannel ?
-            new BoundedFileChannelInputStream(start, remaining) :
+            new BoundedFileChannelInputStream(start, remaining, (FileChannel) archive) :
             new BoundedSeekableByteChannelInputStream(start, remaining, archive);
     }