Polish "Remove unused SHA-1 hash from UNPACK markers"

See gh-46520
This commit is contained in:
Andy Wilkinson 2025-10-03 12:47:03 +01:00
parent d5717b71ab
commit 53cda6a6a1
8 changed files with 11 additions and 11 deletions

View File

@ -610,7 +610,7 @@ class BootZipCopyAction implements CopyAction {
entry.setCrc(this.crc.getValue()); entry.setCrc(this.crc.getValue());
entry.setMethod(ZipEntry.STORED); entry.setMethod(ZipEntry.STORED);
if (this.unpack) { if (this.unpack) {
entry.setComment("UNPACK:"); entry.setComment("UNPACK");
} }
} }

View File

@ -124,7 +124,7 @@ class PackagingDocumentationTests {
try (JarFile jar = new JarFile(file)) { try (JarFile jar = new JarFile(file)) {
JarEntry entry = jar.getJarEntry("BOOT-INF/lib/jruby-complete-1.7.25.jar"); JarEntry entry = jar.getJarEntry("BOOT-INF/lib/jruby-complete-1.7.25.jar");
assertThat(entry).isNotNull(); assertThat(entry).isNotNull();
assertThat(entry.getComment()).startsWith("UNPACK:"); assertThat(entry.getComment()).isEqualTo("UNPACK");
} }
} }

View File

@ -289,7 +289,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
this.task.requiresUnpack("**/one.jar"); this.task.requiresUnpack("**/one.jar");
executeTask(); executeTask();
try (JarFile jarFile = new JarFile(this.task.getArchiveFile().get().getAsFile())) { try (JarFile jarFile = new JarFile(this.task.getArchiveFile().get().getAsFile())) {
assertThat(jarFile.getEntry(this.libPath + "one.jar").getComment()).startsWith("UNPACK:"); assertThat(jarFile.getEntry(this.libPath + "one.jar").getComment()).isEqualTo("UNPACK");
assertThat(jarFile.getEntry(this.libPath + "two.jar").getComment()).isNull(); assertThat(jarFile.getEntry(this.libPath + "two.jar").getComment()).isNull();
} }
} }
@ -301,7 +301,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
this.task.requiresUnpack((element) -> element.getName().endsWith("two.jar")); this.task.requiresUnpack((element) -> element.getName().endsWith("two.jar"));
executeTask(); executeTask();
try (JarFile jarFile = new JarFile(this.task.getArchiveFile().get().getAsFile())) { try (JarFile jarFile = new JarFile(this.task.getArchiveFile().get().getAsFile())) {
assertThat(jarFile.getEntry(this.libPath + "two.jar").getComment()).startsWith("UNPACK:"); assertThat(jarFile.getEntry(this.libPath + "two.jar").getComment()).isEqualTo("UNPACK");
assertThat(jarFile.getEntry(this.libPath + "one.jar").getComment()).isNull(); assertThat(jarFile.getEntry(this.libPath + "one.jar").getComment()).isNull();
} }
} }

View File

@ -159,7 +159,7 @@ abstract class AbstractArchiveIntegrationTests {
Optional<JarEntry> match = entries.filter((entry) -> entry.getName().startsWith(prefix)) Optional<JarEntry> match = entries.filter((entry) -> entry.getName().startsWith(prefix))
.findFirst(); .findFirst();
assertThat(match).as("Name starting with %s", prefix) assertThat(match).as("Name starting with %s", prefix)
.hasValueSatisfying((entry) -> assertThat(entry.getComment()).startsWith("UNPACK:")); .hasValueSatisfying((entry) -> assertThat(entry.getComment()).isEqualTo("UNPACK"));
}); });
}); });
return this; return this;

View File

@ -345,7 +345,7 @@ public abstract class AbstractJarWriter implements LoaderClassesWriter {
entry.setCrc(this.crc.getValue()); entry.setCrc(this.crc.getValue());
entry.setMethod(ZipEntry.STORED); entry.setMethod(ZipEntry.STORED);
if (this.unpack) { if (this.unpack) {
entry.setComment("UNPACK:"); entry.setComment("UNPACK");
} }
} }

View File

@ -208,7 +208,7 @@ abstract class AbstractPackagerTests<P extends Packager> {
ZipEntry entry = getPackagedEntry("BOOT-INF/lib/" + libJarFile.getName()); ZipEntry entry = getPackagedEntry("BOOT-INF/lib/" + libJarFile.getName());
assertThat(entry.getTime()).isEqualTo(JAN_1_1985); assertThat(entry.getTime()).isEqualTo(JAN_1_1985);
entry = getPackagedEntry("BOOT-INF/lib/" + libJarFileToUnpack.getName()); entry = getPackagedEntry("BOOT-INF/lib/" + libJarFileToUnpack.getName());
assertThat(entry.getComment()).isEqualTo("UNPACK:"); assertThat(entry.getComment()).isEqualTo("UNPACK");
} }
@Test @Test
@ -423,7 +423,7 @@ abstract class AbstractPackagerTests<P extends Packager> {
this.testJarFile.addClass("A.class", ClassWithMainMethod.class); this.testJarFile.addClass("A.class", ClassWithMainMethod.class);
P packager = createPackager(); P packager = createPackager();
execute(packager, (callback) -> callback.library(newLibrary(nestedFile, LibraryScope.COMPILE, true))); execute(packager, (callback) -> callback.library(newLibrary(nestedFile, LibraryScope.COMPILE, true)));
assertThat(getPackagedEntry(name).getComment()).startsWith("UNPACK:"); assertThat(getPackagedEntry(name).getComment()).isEqualTo("UNPACK");
} }
@Test @Test
@ -538,7 +538,7 @@ abstract class AbstractPackagerTests<P extends Packager> {
assertThat(getPackagedEntryNames()).containsSubsequence("org/springframework/boot/loader/", assertThat(getPackagedEntryNames()).containsSubsequence("org/springframework/boot/loader/",
"WEB-INF/classes/com/example/Application.class", "WEB-INF/lib/" + library.getName()); "WEB-INF/classes/com/example/Application.class", "WEB-INF/lib/" + library.getName());
ZipEntry unpackLibrary = getPackagedEntry("WEB-INF/lib/" + library.getName()); ZipEntry unpackLibrary = getPackagedEntry("WEB-INF/lib/" + library.getName());
assertThat(unpackLibrary.getComment()).startsWith("UNPACK:"); assertThat(unpackLibrary.getComment()).isEqualTo("UNPACK");
} }
@Test @Test

View File

@ -48,7 +48,7 @@ import org.springframework.boot.loader.net.protocol.jar.JarUrl;
*/ */
class JarFileArchive implements Archive { class JarFileArchive implements Archive {
private static final String UNPACK_MARKER = "UNPACK:"; private static final String UNPACK_MARKER = "UNPACK";
private static final FileAttribute<?>[] NO_FILE_ATTRIBUTES = {}; private static final FileAttribute<?>[] NO_FILE_ATTRIBUTES = {};

View File

@ -90,7 +90,7 @@ public abstract class TestJar {
nestedEntry.setSize(nestedJarData.length); nestedEntry.setSize(nestedJarData.length);
nestedEntry.setCompressedSize(nestedJarData.length); nestedEntry.setCompressedSize(nestedJarData.length);
if (unpackNested) { if (unpackNested) {
nestedEntry.setComment("UNPACK:0000000000000000000000000000000000000000"); nestedEntry.setComment("UNPACK");
} }
CRC32 crc32 = new CRC32(); CRC32 crc32 = new CRC32();
crc32.update(nestedJarData); crc32.update(nestedJarData);