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.setMethod(ZipEntry.STORED);
if (this.unpack) {
entry.setComment("UNPACK:");
entry.setComment("UNPACK");
}
}

View File

@ -124,7 +124,7 @@ class PackagingDocumentationTests {
try (JarFile jar = new JarFile(file)) {
JarEntry entry = jar.getJarEntry("BOOT-INF/lib/jruby-complete-1.7.25.jar");
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");
executeTask();
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();
}
}
@ -301,7 +301,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
this.task.requiresUnpack((element) -> element.getName().endsWith("two.jar"));
executeTask();
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();
}
}

View File

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

View File

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

View File

@ -48,7 +48,7 @@ import org.springframework.boot.loader.net.protocol.jar.JarUrl;
*/
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 = {};

View File

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