From dd082c6c2119eeedd017848fc4f8809f61ee5979 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 31 Jan 2024 17:21:32 +0000 Subject: [PATCH] Revert "Upgrade to Commons Compress 1.25.0" This reverts commit 1c2a622f7fcef9ebd5cb74ade3869a3dfc3ca6af. See gh-39148 --- spring-boot-project/spring-boot-parent/build.gradle | 2 +- .../boot/buildpack/platform/build/ImageBuildpack.java | 4 ++-- .../buildpack/platform/build/TarGzipBuildpack.java | 4 ++-- .../boot/buildpack/platform/docker/DockerApi.java | 8 ++++---- .../platform/build/DirectoryBuildpackTests.java | 4 ++-- .../buildpack/platform/build/ImageBuildpackTests.java | 4 ++-- .../boot/buildpack/platform/docker/DockerApiTests.java | 8 ++++---- .../platform/docker/type/ImageArchiveTests.java | 10 +++++----- .../buildpack/platform/docker/type/LayerTests.java | 6 +++--- .../boot/buildpack/platform/io/TarArchiveTests.java | 4 ++-- .../buildpack/platform/io/TarLayoutWriterTests.java | 4 ++-- .../buildpack/platform/io/ZipFileTarArchiveTests.java | 4 ++-- .../ApplicationPluginActionIntegrationTests.java | 4 ++-- .../boot/image/assertions/ImageAssert.java | 8 ++++---- 14 files changed, 37 insertions(+), 37 deletions(-) diff --git a/spring-boot-project/spring-boot-parent/build.gradle b/spring-boot-project/spring-boot-parent/build.gradle index cf30f9dd587..48b8d88b3b6 100644 --- a/spring-boot-project/spring-boot-parent/build.gradle +++ b/spring-boot-project/spring-boot-parent/build.gradle @@ -34,7 +34,7 @@ bom { ] } } - library("Commons Compress", "1.25.0") { + library("Commons Compress", "1.21") { group("org.apache.commons") { modules = [ "commons-compress" diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/ImageBuildpack.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/ImageBuildpack.java index 827f4a8da01..31c84cefc10 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/ImageBuildpack.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/ImageBuildpack.java @@ -131,12 +131,12 @@ final class ImageBuildpack implements Buildpack { try (TarArchiveInputStream tarIn = new TarArchiveInputStream(Files.newInputStream(path)); TarArchiveOutputStream tarOut = new TarArchiveOutputStream(out)) { tarOut.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX); - TarArchiveEntry entry = tarIn.getNextEntry(); + TarArchiveEntry entry = tarIn.getNextTarEntry(); while (entry != null) { tarOut.putArchiveEntry(entry); StreamUtils.copy(tarIn, tarOut); tarOut.closeArchiveEntry(); - entry = tarIn.getNextEntry(); + entry = tarIn.getNextTarEntry(); } tarOut.finish(); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/TarGzipBuildpack.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/TarGzipBuildpack.java index 4174166f3d2..b485552efcd 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/TarGzipBuildpack.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/TarGzipBuildpack.java @@ -90,13 +90,13 @@ final class TarGzipBuildpack implements Buildpack { new GzipCompressorInputStream(Files.newInputStream(this.path))); TarArchiveOutputStream output = new TarArchiveOutputStream(outputStream)) { writeBasePathEntries(output, basePath); - TarArchiveEntry entry = tar.getNextEntry(); + TarArchiveEntry entry = tar.getNextTarEntry(); while (entry != null) { entry.setName(basePath + "/" + entry.getName()); output.putArchiveEntry(entry); StreamUtils.copy(tar, output); output.closeArchiveEntry(); - entry = tar.getNextEntry(); + entry = tar.getNextTarEntry(); } output.finish(); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerApi.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerApi.java index ad53e823d27..4efc4a0c7cb 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerApi.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerApi.java @@ -295,14 +295,14 @@ public class DockerApi { Path exportFile = copyToTemp(response.getContent()); ImageArchiveManifest manifest = getManifest(reference, exportFile); try (TarArchiveInputStream tar = new TarArchiveInputStream(new FileInputStream(exportFile.toFile()))) { - TarArchiveEntry entry = tar.getNextEntry(); + TarArchiveEntry entry = tar.getNextTarEntry(); while (entry != null) { if (manifestContainsLayerEntry(manifest, entry.getName())) { Path layerFile = copyToTemp(tar); exports.accept(entry.getName(), layerFile); Files.delete(layerFile); } - entry = tar.getNextEntry(); + entry = tar.getNextTarEntry(); } } Files.delete(exportFile); @@ -347,12 +347,12 @@ public class DockerApi { private ImageArchiveManifest getManifest(ImageReference reference, Path exportFile) throws IOException { try (TarArchiveInputStream tar = new TarArchiveInputStream(new FileInputStream(exportFile.toFile()))) { - TarArchiveEntry entry = tar.getNextEntry(); + TarArchiveEntry entry = tar.getNextTarEntry(); while (entry != null) { if (entry.getName().equals("manifest.json")) { return readManifest(tar); } - entry = tar.getNextEntry(); + entry = tar.getNextTarEntry(); } } throw new IllegalArgumentException("Manifest not found in image " + reference); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/DirectoryBuildpackTests.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/DirectoryBuildpackTests.java index 3fdbd121859..d33757f1906 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/DirectoryBuildpackTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/DirectoryBuildpackTests.java @@ -128,10 +128,10 @@ class DirectoryBuildpackTests { byte[] content = layers.get(0).toByteArray(); try (TarArchiveInputStream tar = new TarArchiveInputStream(new ByteArrayInputStream(content))) { List entries = new ArrayList<>(); - TarArchiveEntry entry = tar.getNextEntry(); + TarArchiveEntry entry = tar.getNextTarEntry(); while (entry != null) { entries.add(entry); - entry = tar.getNextEntry(); + entry = tar.getNextTarEntry(); } assertThat(entries).extracting("name", "mode") .containsExactlyInAnyOrder(tuple("/cnb/", 0755), tuple("/cnb/buildpacks/", 0755), diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/ImageBuildpackTests.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/ImageBuildpackTests.java index 7978de12eb2..f42d6ee60b6 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/ImageBuildpackTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/ImageBuildpackTests.java @@ -215,10 +215,10 @@ class ImageBuildpackTests extends AbstractJsonTests { byte[] content = layers.get(0).toByteArray(); List entries = new ArrayList<>(); try (TarArchiveInputStream tar = new TarArchiveInputStream(new ByteArrayInputStream(content))) { - TarArchiveEntry entry = tar.getNextEntry(); + TarArchiveEntry entry = tar.getNextTarEntry(); while (entry != null) { entries.add(entry); - entry = tar.getNextEntry(); + entry = tar.getNextTarEntry(); } } assertThat(entries).extracting("name", "mode") diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/DockerApiTests.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/DockerApiTests.java index f751ada70cd..814914861b2 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/DockerApiTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/DockerApiTests.java @@ -336,10 +336,10 @@ class DockerApiTests { archive.writeTo(out); try (TarArchiveInputStream in = new TarArchiveInputStream( new ByteArrayInputStream(out.toByteArray()))) { - TarArchiveEntry entry = in.getNextEntry(); + TarArchiveEntry entry = in.getNextTarEntry(); while (entry != null) { contents.add(name, entry.getName()); - entry = in.getNextEntry(); + entry = in.getNextTarEntry(); } } }); @@ -364,10 +364,10 @@ class DockerApiTests { archive.writeTo(out); try (TarArchiveInputStream in = new TarArchiveInputStream( new ByteArrayInputStream(out.toByteArray()))) { - TarArchiveEntry entry = in.getNextEntry(); + TarArchiveEntry entry = in.getNextTarEntry(); while (entry != null) { contents.add(name, entry.getName()); - entry = in.getNextEntry(); + entry = in.getNextTarEntry(); } } }); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/type/ImageArchiveTests.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/type/ImageArchiveTests.java index 123f49bbcdd..20717b8a5d7 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/type/ImageArchiveTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/type/ImageArchiveTests.java @@ -54,14 +54,14 @@ class ImageArchiveTests extends AbstractJsonTests { try (TarArchiveInputStream tar = new TarArchiveInputStream( new ByteArrayInputStream(outputStream.toByteArray()))) { for (int i = 0; i < EXISTING_IMAGE_LAYER_COUNT; i++) { - TarArchiveEntry blankEntry = tar.getNextEntry(); + TarArchiveEntry blankEntry = tar.getNextTarEntry(); assertThat(blankEntry.getName()).isEqualTo("blank_" + i); } - TarArchiveEntry layerEntry = tar.getNextEntry(); + TarArchiveEntry layerEntry = tar.getNextTarEntry(); byte[] layerContent = read(tar, layerEntry.getSize()); - TarArchiveEntry configEntry = tar.getNextEntry(); + TarArchiveEntry configEntry = tar.getNextTarEntry(); byte[] configContent = read(tar, configEntry.getSize()); - TarArchiveEntry manifestEntry = tar.getNextEntry(); + TarArchiveEntry manifestEntry = tar.getNextTarEntry(); byte[] manifestContent = read(tar, manifestEntry.getSize()); assertExpectedLayer(layerEntry, layerContent); assertExpectedConfig(configEntry, configContent); @@ -72,7 +72,7 @@ class ImageArchiveTests extends AbstractJsonTests { private void assertExpectedLayer(TarArchiveEntry entry, byte[] content) throws Exception { assertThat(entry.getName()).isEqualTo("bb09e17fd1bd2ee47155f1349645fcd9fff31e1247c7ed99cad469f1c16a4216.tar"); try (TarArchiveInputStream tar = new TarArchiveInputStream(new ByteArrayInputStream(content))) { - TarArchiveEntry contentEntry = tar.getNextEntry(); + TarArchiveEntry contentEntry = tar.getNextTarEntry(); assertThat(contentEntry.getName()).isEqualTo("/spring/"); } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/type/LayerTests.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/type/LayerTests.java index bad2124fb8d..b07861d7fb5 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/type/LayerTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/type/LayerTests.java @@ -61,9 +61,9 @@ class LayerTests { layer.writeTo(outputStream); try (TarArchiveInputStream tarStream = new TarArchiveInputStream( new ByteArrayInputStream(outputStream.toByteArray()))) { - assertThat(tarStream.getNextEntry().getName()).isEqualTo("/directory/"); - assertThat(tarStream.getNextEntry().getName()).isEqualTo("/directory/file"); - assertThat(tarStream.getNextEntry()).isNull(); + assertThat(tarStream.getNextTarEntry().getName()).isEqualTo("/directory/"); + assertThat(tarStream.getNextTarEntry().getName()).isEqualTo("/directory/file"); + assertThat(tarStream.getNextTarEntry()).isNull(); } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/io/TarArchiveTests.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/io/TarArchiveTests.java index 1a587eb5be6..615dc03a0fa 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/io/TarArchiveTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/io/TarArchiveTests.java @@ -58,10 +58,10 @@ class TarArchiveTests { try (TarArchiveInputStream tarStream = new TarArchiveInputStream( new ByteArrayInputStream(outputStream.toByteArray()))) { List entries = new ArrayList<>(); - TarArchiveEntry entry = tarStream.getNextEntry(); + TarArchiveEntry entry = tarStream.getNextTarEntry(); while (entry != null) { entries.add(entry); - entry = tarStream.getNextEntry(); + entry = tarStream.getNextTarEntry(); } assertThat(entries).hasSize(6); assertThat(entries.get(0).getName()).isEqualTo("/workspace/"); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/io/TarLayoutWriterTests.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/io/TarLayoutWriterTests.java index f212ad69fe5..1bb1d87fdbd 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/io/TarLayoutWriterTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/io/TarLayoutWriterTests.java @@ -44,8 +44,8 @@ class TarLayoutWriterTests { } try (TarArchiveInputStream tarInputStream = new TarArchiveInputStream( new ByteArrayInputStream(outputStream.toByteArray()))) { - TarArchiveEntry directoryEntry = tarInputStream.getNextEntry(); - TarArchiveEntry fileEntry = tarInputStream.getNextEntry(); + TarArchiveEntry directoryEntry = tarInputStream.getNextTarEntry(); + TarArchiveEntry fileEntry = tarInputStream.getNextTarEntry(); byte[] fileContent = new byte[(int) fileEntry.getSize()]; tarInputStream.read(fileContent); assertThat(tarInputStream.getNextEntry()).isNull(); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/io/ZipFileTarArchiveTests.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/io/ZipFileTarArchiveTests.java index 48c2f6f70e1..a1c887510d2 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/io/ZipFileTarArchiveTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/io/ZipFileTarArchiveTests.java @@ -67,11 +67,11 @@ class ZipFileTarArchiveTests { tarArchive.writeTo(outputStream); try (TarArchiveInputStream tarStream = new TarArchiveInputStream( new ByteArrayInputStream(outputStream.toByteArray()))) { - TarArchiveEntry dirEntry = tarStream.getNextEntry(); + TarArchiveEntry dirEntry = tarStream.getNextTarEntry(); assertThat(dirEntry.getName()).isEqualTo("spring/"); assertThat(dirEntry.getLongUserId()).isEqualTo(123); assertThat(dirEntry.getLongGroupId()).isEqualTo(456); - TarArchiveEntry fileEntry = tarStream.getNextEntry(); + TarArchiveEntry fileEntry = tarStream.getNextTarEntry(); assertThat(fileEntry.getName()).isEqualTo("spring/boot"); assertThat(fileEntry.getLongUserId()).isEqualTo(123); assertThat(fileEntry.getLongGroupId()).isEqualTo(456); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/ApplicationPluginActionIntegrationTests.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/ApplicationPluginActionIntegrationTests.java index 292dd2bbd52..6d2daf320a1 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/ApplicationPluginActionIntegrationTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/ApplicationPluginActionIntegrationTests.java @@ -195,7 +195,7 @@ class ApplicationPluginActionIntegrationTests { List entryNames = new ArrayList<>(); try (TarArchiveInputStream input = new TarArchiveInputStream(new FileInputStream(distribution))) { TarArchiveEntry entry; - while ((entry = input.getNextEntry()) != null) { + while ((entry = input.getNextTarEntry()) != null) { entryNames.add(entry.getName()); } } @@ -205,7 +205,7 @@ class ApplicationPluginActionIntegrationTests { private void tarEntries(File distribution, Consumer consumer) throws IOException { try (TarArchiveInputStream input = new TarArchiveInputStream(new FileInputStream(distribution))) { TarArchiveEntry entry; - while ((entry = input.getNextEntry()) != null) { + while ((entry = input.getNextTarEntry()) != null) { consumer.accept(entry); } } diff --git a/spring-boot-system-tests/spring-boot-image-tests/src/systemTest/java/org/springframework/boot/image/assertions/ImageAssert.java b/spring-boot-system-tests/spring-boot-image-tests/src/systemTest/java/org/springframework/boot/image/assertions/ImageAssert.java index fc5f9509412..ce326c1702b 100644 --- a/spring-boot-system-tests/spring-boot-image-tests/src/systemTest/java/org/springframework/boot/image/assertions/ImageAssert.java +++ b/spring-boot-system-tests/spring-boot-image-tests/src/systemTest/java/org/springframework/boot/image/assertions/ImageAssert.java @@ -80,12 +80,12 @@ public class ImageAssert extends AbstractAssert { this.actual.writeTo(out); try (TarArchiveInputStream in = new TarArchiveInputStream( new ByteArrayInputStream(out.toByteArray()))) { - TarArchiveEntry entry = in.getNextEntry(); + TarArchiveEntry entry = in.getNextTarEntry(); while (entry != null) { if (!entry.isDirectory()) { entryNames.add(entry.getName().replaceFirst("^/workspace/", "")); } - entry = in.getNextEntry(); + entry = in.getNextTarEntry(); } } } @@ -101,7 +101,7 @@ public class ImageAssert extends AbstractAssert { this.actual.writeTo(out); try (TarArchiveInputStream in = new TarArchiveInputStream( new ByteArrayInputStream(out.toByteArray()))) { - TarArchiveEntry entry = in.getNextEntry(); + TarArchiveEntry entry = in.getNextTarEntry(); while (entry != null) { if (entry.getName().equals(name)) { ByteArrayOutputStream entryOut = new ByteArrayOutputStream(); @@ -109,7 +109,7 @@ public class ImageAssert extends AbstractAssert { assertConsumer.accept(new JsonContentAssert(LayerContentAssert.class, entryOut.toString())); return; } - entry = in.getNextEntry(); + entry = in.getNextTarEntry(); } } failWithMessage("Expected JSON entry '%s' in layer with digest '%s'", name, this.actual.getId());