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 2022/02/14 15:56:08 UTC

[commons-compress] branch master updated (6860cf1 -> af2339a)

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 6860cf1  Fix thread safety issues when encoding 7z password (#248)
     new aa5177c  Fix thread safety issues when encoding 7z password #248.
     new ee88e69  Use final.
     new af2339a  Use {} notation.

The 3 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:
 src/changes/changes.xml                                    |  3 +++
 .../commons/compress/archivers/sevenz/SevenZFile.java      | 14 +++++++-------
 .../commons/compress/archivers/zip/ZipArchiveEntry.java    |  2 +-
 3 files changed, 11 insertions(+), 8 deletions(-)

[commons-compress] 02/03: Use final.

Posted by gg...@apache.org.
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 ee88e69be20ed3f0302acf2e1dd911cbf995aedf
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Feb 14 10:50:11 2022 -0500

    Use final.
---
 .../commons/compress/archivers/sevenz/SevenZFile.java      | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
index 1fd6300..3b2b8cd 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
@@ -667,7 +667,7 @@ public class SevenZFile implements Closeable {
     private ByteBuffer readEncodedHeader(final ByteBuffer header, final Archive archive,
                                          final byte[] password) throws IOException {
         final int pos = header.position();
-        ArchiveStatistics stats = new ArchiveStatistics();
+        final ArchiveStatistics stats = new ArchiveStatistics();
         sanityCheckStreamsInfo(header, stats);
         stats.assertValidity(options.getMaxMemoryLimitInKb());
         header.position(pos);
@@ -848,7 +848,7 @@ public class SevenZFile implements Closeable {
             throw new IOException("Expected kCodersUnpackSize, got " + nid);
         }
 
-        for (int numberOfOutputStreams : numberOfOutputStreamsPerFolder) {
+        for (final int numberOfOutputStreams : numberOfOutputStreamsPerFolder) {
             for (int i = 0; i < numberOfOutputStreams; i++) {
                 final long unpackSize = readUint64(header);
                 if (unpackSize < 0) {
@@ -1934,10 +1934,10 @@ public class SevenZFile implements Closeable {
         long value = 0;
         for (int i = 0; i < 8; i++) {
             if ((firstByte & mask) == 0) {
-                return value | ((firstByte & (mask - 1)) << (8 * i));
+                return value | (firstByte & mask - 1) << 8 * i;
             }
             final long nextByte = getUnsignedByte(in);
-            value |= nextByte << (8 * i);
+            value |= nextByte << 8 * i;
             mask >>>= 1;
         }
         return value;
@@ -2089,11 +2089,11 @@ public class SevenZFile implements Closeable {
         @Override
         public String toString() {
             return "Archive with " + numberOfEntries + " entries in " + numberOfFolders
-                + " folders. Estimated size " + (estimateSize()/ 1024L) + " kB.";
+                + " folders. Estimated size " + estimateSize()/ 1024L + " kB.";
         }
 
         long estimateSize() {
-            long lowerBound = 16L * numberOfPackedStreams /* packSizes, packCrcs in Archive */
+            final long lowerBound = 16L * numberOfPackedStreams /* packSizes, packCrcs in Archive */
                 + numberOfPackedStreams / 8 /* packCrcsDefined in Archive */
                 + numberOfFolders * folderSize() /* folders in Archive */
                 + numberOfCoders * coderSize() /* coders in Folder */
@@ -2106,7 +2106,7 @@ public class SevenZFile implements Closeable {
             return 2 * lowerBound /* conservative guess */;
         }
 
-        void assertValidity(int maxMemoryLimitInKb) throws IOException {
+        void assertValidity(final int maxMemoryLimitInKb) throws IOException {
             if (numberOfEntriesWithStream > 0 && numberOfFolders == 0) {
                 throw new IOException("archive with entries but no folders");
             }

[commons-compress] 03/03: Use {} notation.

Posted by gg...@apache.org.
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 af2339a30fdf363da730832264682a4a9dbec0a4
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Feb 14 10:56:06 2022 -0500

    Use {} notation.
---
 .../java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
index ff51b82..bb3208e 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
@@ -149,7 +149,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
     private NameSource nameSource = NameSource.NAME;
     private CommentSource commentSource = CommentSource.COMMENT;
     private long diskNumberStart;
-    static final ZipArchiveEntry[] EMPTY_ZIP_ARCHIVE_ENTRY_ARRAY = new ZipArchiveEntry[0];
+    static final ZipArchiveEntry[] EMPTY_ZIP_ARCHIVE_ENTRY_ARRAY = {};
 
     /**
      * Creates a new zip entry with the specified name.

[commons-compress] 01/03: Fix thread safety issues when encoding 7z password #248.

Posted by gg...@apache.org.
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 aa5177cb714e46a3ed33805d940f93cad09b0fbc
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Feb 14 10:48:52 2022 -0500

    Fix thread safety issues when encoding 7z password #248.
---
 src/changes/changes.xml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index db11a56..e228838 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -73,6 +73,9 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="fix" dev="ggregory" due-to="Arturo Bernal">
         Replace manual copy of array contents with System.arraycopy() #246.
       </action>
+      <action type="fix" dev="ggregory" due-to="Glavo, Bruno P. Kinoshita, PeterAlfredLee, Gary Gregory">
+        Fix thread safety issues when encoding 7z password #248.
+      </action>
       <!-- ADD -->
       <action issue="COMPRESS-602" type="add" dev="ggregory" due-to="Postelnicu George, Gary Gregory">
         Migrate zip package to use NIO #236.