You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bo...@apache.org on 2020/01/21 17:30:10 UTC
[commons-compress] 02/04: Merge branch 'master' of
https://github.com/apache/commons-compress into COMPRESS-477-zip64
This is an automated email from the ASF dual-hosted git repository.
bodewig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git
commit 13cd268a4c99045a32a30ef5dc3d63ea04477d18
Merge: b4fd49a f161254
Author: Lee <pe...@gmail.com>
AuthorDate: Tue Jan 7 21:19:55 2020 +0800
Merge branch 'master' of https://github.com/apache/commons-compress into COMPRESS-477-zip64
.travis.yml | 4 +-
NOTICE.txt | 2 +-
RELEASE-NOTES.txt | 3 +
src/changes/changes.xml | 19 +-
.../compress/archivers/tar/TarArchiveEntry.java | 56 ++-
.../archivers/tar/TarArchiveInputStream.java | 415 +++++++++++++++++++--
.../archivers/tar/TarArchiveSparseEntry.java | 22 ++
.../archivers/tar/TarArchiveStructSparse.java | 82 ++++
.../compress/archivers/tar/TarConstants.java | 24 ++
.../commons/compress/archivers/tar/TarUtils.java | 19 +-
.../archivers/zip/ZipArchiveOutputStream.java | 11 +-
.../zip/ZipSplitReadOnlySeekableByteChannel.java | 6 +-
.../commons/compress/utils/BoundedInputStream.java | 12 +
.../utils/MultiReadOnlySeekableByteChannel.java | 13 +
.../utils/SeekableInMemoryByteChannel.java | 40 +-
src/site/xdoc/index.xml | 2 +
src/site/xdoc/limitations.xml | 12 +-
src/site/xdoc/zip.xml | 55 ++-
.../org/apache/commons/compress/OsgiITest.java | 23 ++
.../compress/archivers/tar/SparseFilesTest.java | 182 ++++++++-
.../archivers/tar/TarArchiveInputStreamTest.java | 10 +-
.../compress/archivers/tar/TarUtilsTest.java | 12 +
.../MultiReadOnlySeekableByteChannelTest.java | 93 +++++
.../utils/SeekableInMemoryByteChannelTest.java | 222 ++++++++++-
src/test/resources/oldgnu_extended_sparse.tar | Bin 0 -> 10240 bytes
25 files changed, 1270 insertions(+), 69 deletions(-)
diff --cc src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
index 759aa75,0ad4f8b..f630036
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
@@@ -1484,9 -1474,20 +1484,11 @@@ public class ZipArchiveOutputStream ext
// number of entries
final int numberOfEntries = entries.size();
- if (numberOfEntries > ZIP64_MAGIC_SHORT
- && zip64Mode == Zip64Mode.Never) {
- throw new Zip64RequiredException(Zip64RequiredException
- .TOO_MANY_ENTRIES_MESSAGE);
- }
- if (cdOffset > ZIP64_MAGIC && zip64Mode == Zip64Mode.Never) {
- throw new Zip64RequiredException(Zip64RequiredException
- .ARCHIVE_TOO_BIG_MESSAGE);
- }
// total number of entries in the central directory on this disk
- int numOfEntriesOnThisDisk = numberOfCDInDiskData.get(numberOfThisDisk) == null ? 0 : numberOfCDInDiskData.get(numberOfThisDisk);
+ int numOfEntriesOnThisDisk = isSplitZip
+ ? (numberOfCDInDiskData.get(numberOfThisDisk) == null ? 0 : numberOfCDInDiskData.get(numberOfThisDisk))
+ : numberOfEntries;
final byte[] numOfEntriesOnThisDiskData = ZipShort
.getBytes(Math.min(numOfEntriesOnThisDisk, ZIP64_MAGIC_SHORT));
writeCounted(numOfEntriesOnThisDiskData);