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 2025/08/03 17:42:21 UTC
(commons-compress) branch master updated (7a6bf75f6 -> 1d81b00dc)
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 7a6bf75f6 Add org.apache.commons.compress.archivers.cpio.CpioArchiveInputStreamTest.testEndOfFileInEntry_c_namesize_0x7FFFFFFF()
new dc8f8900a Add org.apache.commons.compress.archivers.sevenz.SevenZFileTest.testAssertFitsIntoNonNegativeInt()
new 1d81b00dc Format tweaks
The 2 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:
.../compress/archivers/sevenz/SevenZFileTest.java | 82 ++++++++++++++++-----
.../sevenz/assertFitsIntoNonNegativeInt.bin | Bin 0 -> 39 bytes
2 files changed, 62 insertions(+), 20 deletions(-)
create mode 100644 src/test/resources/org/apache/commons/compress/sevenz/assertFitsIntoNonNegativeInt.bin
(commons-compress) 02/02: Format tweaks
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 1d81b00dcaf3dc088561a27d6a9df50b5ad65a48
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sun Aug 3 13:42:16 2025 -0400
Format tweaks
---
.../compress/archivers/sevenz/SevenZFileTest.java | 76 ++++++++++++++++------
1 file changed, 56 insertions(+), 20 deletions(-)
diff --git a/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java b/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java
index 5efd79059..bbb0284f0 100644
--- a/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java
@@ -286,10 +286,19 @@ void testExtractNonExistSpecifiedFile() throws Exception {
@Test
void testExtractSpecifiedFile() throws Exception {
try (SevenZFile sevenZFile = getSevenZFile("COMPRESS-256.7z")) {
- final String testTxtContents = "111111111111111111111111111000101011\n" + "111111111111111111111111111000101011\n"
- + "111111111111111111111111111000101011\n" + "111111111111111111111111111000101011\n" + "111111111111111111111111111000101011\n"
- + "111111111111111111111111111000101011\n" + "111111111111111111111111111000101011\n" + "111111111111111111111111111000101011\n"
- + "111111111111111111111111111000101011\n" + "111111111111111111111111111000101011";
+ // @formatter:off
+ final String testTxtContents =
+ "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011";
+ // @formatter:off
for (final SevenZArchiveEntry entry : sevenZFile.getEntries()) {
if (entry.getName().equals("commons-compress-1.7-src/src/test/resources/test.txt")) {
final byte[] contents = new byte[(int) entry.getSize()];
@@ -311,10 +320,19 @@ void testExtractSpecifiedFile() throws Exception {
void testExtractSpecifiedFileDeprecated() throws Exception {
try (@SuppressWarnings("deprecation")
SevenZFile sevenZFile = new SevenZFile(getFile("COMPRESS-256.7z"))) {
- final String testTxtContents = "111111111111111111111111111000101011\n" + "111111111111111111111111111000101011\n"
- + "111111111111111111111111111000101011\n" + "111111111111111111111111111000101011\n" + "111111111111111111111111111000101011\n"
- + "111111111111111111111111111000101011\n" + "111111111111111111111111111000101011\n" + "111111111111111111111111111000101011\n"
- + "111111111111111111111111111000101011\n" + "111111111111111111111111111000101011";
+ // @formatter:off
+ final String testTxtContents =
+ "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011";
+ // @formatter:on
for (final SevenZArchiveEntry entry : sevenZFile.getEntries()) {
if (entry.getName().equals("commons-compress-1.7-src/src/test/resources/test.txt")) {
final byte[] contents = new byte[(int) entry.getSize()];
@@ -547,7 +565,8 @@ void testRandomAccessMultipleReadSameFile() throws Exception {
void testRandomAccessTogetherWithSequentialAccess() throws Exception {
try (SevenZFile sevenZFile = getSevenZFile("COMPRESS-256.7z")) {
// @formatter:off
- final String testTxtContents = "111111111111111111111111111000101011\n"
+ final String testTxtContents =
+ "111111111111111111111111111000101011\n"
+ "111111111111111111111111111000101011\n"
+ "111111111111111111111111111000101011\n"
+ "111111111111111111111111111000101011\n"
@@ -557,7 +576,8 @@ void testRandomAccessTogetherWithSequentialAccess() throws Exception {
+ "111111111111111111111111111000101011\n"
+ "111111111111111111111111111000101011\n"
+ "111111111111111111111111111000101011";
- final String filesTxtContents = "0xxxxxxxxx10xxxxxxxx20xxxxxxxx30xxxxxxxx40xxxxxxxx50xxxxxxxx60xxxxxxxx70xxxxxxxx80xxxxxxxx90xxxxxxxx100"
+ final String filesTxtContents =
+ "0xxxxxxxxx10xxxxxxxx20xxxxxxxx30xxxxxxxx40xxxxxxxx50xxxxxxxx60xxxxxxxx70xxxxxxxx80xxxxxxxx90xxxxxxxx100"
+ "xxxxxxx110xxxxxxx120xxxxxxx130xxxxxxx -> 0yyyyyyyyy10yyyyyyyy20yyyyyyyy30yyyyyyyy40yyyyyyyy50yyyyyyyy60yyyyyyyy70yyyyyyyy80"
+ "yyyyyyyy90yyyyyyyy100yyyyyyy110yyyyyyy120yyyyyyy130yyyyyyy\n";
// @formatter:on
@@ -620,11 +640,19 @@ void testRandomAccessTogetherWithSequentialAccess() throws Exception {
@Test
void testRandomAccessWhenJumpingBackwards() throws Exception {
try (SevenZFile sevenZFile = getSevenZFile("COMPRESS-256.7z")) {
- final String testTxtContents = "111111111111111111111111111000101011\n" + "111111111111111111111111111000101011\n"
- + "111111111111111111111111111000101011\n" + "111111111111111111111111111000101011\n" + "111111111111111111111111111000101011\n"
- + "111111111111111111111111111000101011\n" + "111111111111111111111111111000101011\n" + "111111111111111111111111111000101011\n"
- + "111111111111111111111111111000101011\n" + "111111111111111111111111111000101011";
-
+ // @formatter:off
+ final String testTxtContents =
+ "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011";
+ // @formatter:on
SevenZArchiveEntry entry;
SevenZArchiveEntry testTxtEntry = null;
while ((entry = sevenZFile.getNextEntry()) != null) {
@@ -677,11 +705,19 @@ void testRandomAccessWhenJumpingBackwards() throws Exception {
@Test
void testRandomAccessWhenJumpingForwards() throws Exception {
try (SevenZFile sevenZFile = getSevenZFile("COMPRESS-256.7z")) {
- final String testTxtContents = "111111111111111111111111111000101011\n" + "111111111111111111111111111000101011\n"
- + "111111111111111111111111111000101011\n" + "111111111111111111111111111000101011\n" + "111111111111111111111111111000101011\n"
- + "111111111111111111111111111000101011\n" + "111111111111111111111111111000101011\n" + "111111111111111111111111111000101011\n"
- + "111111111111111111111111111000101011\n" + "111111111111111111111111111000101011";
-
+ // @formatter:off
+ final String testTxtContents =
+ "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011\n"
+ + "111111111111111111111111111000101011";
+ // @formatter:on
SevenZArchiveEntry testTxtEntry = null;
final Iterable<SevenZArchiveEntry> entries = sevenZFile.getEntries();
for (final SevenZArchiveEntry Entry : entries) {
(commons-compress) 01/02: Add org.apache.commons.compress.archivers.sevenz.SevenZFileTest.testAssertFitsIntoNonNegativeInt()
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 dc8f8900a4e041c8e8b35e7eeaa47a8e89fe1031
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sun Aug 3 13:39:21 2025 -0400
Add org.apache.commons.compress.archivers.sevenz.SevenZFileTest.testAssertFitsIntoNonNegativeInt()
---
.../commons/compress/archivers/sevenz/SevenZFileTest.java | 6 ++++++
.../compress/sevenz/assertFitsIntoNonNegativeInt.bin | Bin 0 -> 39 bytes
2 files changed, 6 insertions(+)
diff --git a/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java b/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java
index 6f71ec00e..5efd79059 100644
--- a/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java
@@ -243,6 +243,12 @@ void testAllEmptyFilesArchive() throws Exception {
}
}
+ @Test
+ void testAssertFitsIntoNonNegativeInt() throws IOException {
+ assertThrows(ArchiveException.class,
+ () -> SevenZFile.builder().setPath("src/test/resources/org/apache/commons/compress/sevenz/assertFitsIntoNonNegativeInt.bin").get().close());
+ }
+
/**
* @see "https://issues.apache.org/jira/browse/COMPRESS-256"
*/
diff --git a/src/test/resources/org/apache/commons/compress/sevenz/assertFitsIntoNonNegativeInt.bin b/src/test/resources/org/apache/commons/compress/sevenz/assertFitsIntoNonNegativeInt.bin
new file mode 100644
index 000000000..54fcfb469
Binary files /dev/null and b/src/test/resources/org/apache/commons/compress/sevenz/assertFitsIntoNonNegativeInt.bin differ