Browse Source

Revert "Upgrade to Commons Compress 1.25.0"

This reverts commit 1c2a622f7f.

See gh-39148
pull/39395/head
Andy Wilkinson 2 years ago
parent
commit
dd082c6c21
  1. 2
      spring-boot-project/spring-boot-parent/build.gradle
  2. 4
      spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/ImageBuildpack.java
  3. 4
      spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/TarGzipBuildpack.java
  4. 8
      spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerApi.java
  5. 4
      spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/DirectoryBuildpackTests.java
  6. 4
      spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/ImageBuildpackTests.java
  7. 8
      spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/DockerApiTests.java
  8. 10
      spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/type/ImageArchiveTests.java
  9. 6
      spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/type/LayerTests.java
  10. 4
      spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/io/TarArchiveTests.java
  11. 4
      spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/io/TarLayoutWriterTests.java
  12. 4
      spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/io/ZipFileTarArchiveTests.java
  13. 4
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/ApplicationPluginActionIntegrationTests.java
  14. 8
      spring-boot-system-tests/spring-boot-image-tests/src/systemTest/java/org/springframework/boot/image/assertions/ImageAssert.java

2
spring-boot-project/spring-boot-parent/build.gradle

@ -34,7 +34,7 @@ bom { @@ -34,7 +34,7 @@ bom {
]
}
}
library("Commons Compress", "1.25.0") {
library("Commons Compress", "1.21") {
group("org.apache.commons") {
modules = [
"commons-compress"

4
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 { @@ -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();
}

4
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 { @@ -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();
}

8
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 { @@ -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 { @@ -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);

4
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 { @@ -128,10 +128,10 @@ class DirectoryBuildpackTests {
byte[] content = layers.get(0).toByteArray();
try (TarArchiveInputStream tar = new TarArchiveInputStream(new ByteArrayInputStream(content))) {
List<TarArchiveEntry> 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),

4
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 { @@ -215,10 +215,10 @@ class ImageBuildpackTests extends AbstractJsonTests {
byte[] content = layers.get(0).toByteArray();
List<TarArchiveEntry> 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")

8
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 { @@ -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 { @@ -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();
}
}
});

10
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 { @@ -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 { @@ -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/");
}
}

6
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 { @@ -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();
}
}

4
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 { @@ -58,10 +58,10 @@ class TarArchiveTests {
try (TarArchiveInputStream tarStream = new TarArchiveInputStream(
new ByteArrayInputStream(outputStream.toByteArray()))) {
List<TarArchiveEntry> 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/");

4
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 { @@ -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();

4
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 { @@ -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);

4
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 { @@ -195,7 +195,7 @@ class ApplicationPluginActionIntegrationTests {
List<String> 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 { @@ -205,7 +205,7 @@ class ApplicationPluginActionIntegrationTests {
private void tarEntries(File distribution, Consumer<TarArchiveEntry> 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);
}
}

8
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<ImageAssert, ImageReference> { @@ -80,12 +80,12 @@ public class ImageAssert extends AbstractAssert<ImageAssert, ImageReference> {
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<ImageAssert, ImageReference> { @@ -101,7 +101,7 @@ public class ImageAssert extends AbstractAssert<ImageAssert, ImageReference> {
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<ImageAssert, ImageReference> { @@ -109,7 +109,7 @@ public class ImageAssert extends AbstractAssert<ImageAssert, ImageReference> {
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());

Loading…
Cancel
Save