Skip to content

Commit 53cda6a

Browse files
committed
Polish "Remove unused SHA-1 hash from UNPACK markers"
See gh-46520
1 parent d5717b7 commit 53cda6a

File tree

8 files changed

+11
-11
lines changed

8 files changed

+11
-11
lines changed

build-plugin/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootZipCopyAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ void prepareStoredEntry(ZipArchiveEntry entry) {
610610
entry.setCrc(this.crc.getValue());
611611
entry.setMethod(ZipEntry.STORED);
612612
if (this.unpack) {
613-
entry.setComment("UNPACK:");
613+
entry.setComment("UNPACK");
614614
}
615615
}
616616

build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/PackagingDocumentationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ void bootJarRequiresUnpack() throws IOException {
124124
try (JarFile jar = new JarFile(file)) {
125125
JarEntry entry = jar.getJarEntry("BOOT-INF/lib/jruby-complete-1.7.25.jar");
126126
assertThat(entry).isNotNull();
127-
assertThat(entry.getComment()).startsWith("UNPACK:");
127+
assertThat(entry.getComment()).isEqualTo("UNPACK");
128128
}
129129
}
130130

build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ void unpackCommentIsAddedToEntryIdentifiedByAPattern() throws IOException {
289289
this.task.requiresUnpack("**/one.jar");
290290
executeTask();
291291
try (JarFile jarFile = new JarFile(this.task.getArchiveFile().get().getAsFile())) {
292-
assertThat(jarFile.getEntry(this.libPath + "one.jar").getComment()).startsWith("UNPACK:");
292+
assertThat(jarFile.getEntry(this.libPath + "one.jar").getComment()).isEqualTo("UNPACK");
293293
assertThat(jarFile.getEntry(this.libPath + "two.jar").getComment()).isNull();
294294
}
295295
}
@@ -301,7 +301,7 @@ void unpackCommentIsAddedToEntryIdentifiedByASpec() throws IOException {
301301
this.task.requiresUnpack((element) -> element.getName().endsWith("two.jar"));
302302
executeTask();
303303
try (JarFile jarFile = new JarFile(this.task.getArchiveFile().get().getAsFile())) {
304-
assertThat(jarFile.getEntry(this.libPath + "two.jar").getComment()).startsWith("UNPACK:");
304+
assertThat(jarFile.getEntry(this.libPath + "two.jar").getComment()).isEqualTo("UNPACK");
305305
assertThat(jarFile.getEntry(this.libPath + "one.jar").getComment()).isNull();
306306
}
307307
}

build-plugin/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/AbstractArchiveIntegrationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ JarAssert hasUnpackEntryWithNameStartingWith(String prefix) {
159159
Optional<JarEntry> match = entries.filter((entry) -> entry.getName().startsWith(prefix))
160160
.findFirst();
161161
assertThat(match).as("Name starting with %s", prefix)
162-
.hasValueSatisfying((entry) -> assertThat(entry.getComment()).startsWith("UNPACK:"));
162+
.hasValueSatisfying((entry) -> assertThat(entry.getComment()).isEqualTo("UNPACK"));
163163
});
164164
});
165165
return this;

loader/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/AbstractJarWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ void prepareStoredEntry(ZipArchiveEntry entry) {
345345
entry.setCrc(this.crc.getValue());
346346
entry.setMethod(ZipEntry.STORED);
347347
if (this.unpack) {
348-
entry.setComment("UNPACK:");
348+
entry.setComment("UNPACK");
349349
}
350350
}
351351

loader/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/AbstractPackagerTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ void libraries() throws Exception {
208208
ZipEntry entry = getPackagedEntry("BOOT-INF/lib/" + libJarFile.getName());
209209
assertThat(entry.getTime()).isEqualTo(JAN_1_1985);
210210
entry = getPackagedEntry("BOOT-INF/lib/" + libJarFileToUnpack.getName());
211-
assertThat(entry.getComment()).isEqualTo("UNPACK:");
211+
assertThat(entry.getComment()).isEqualTo("UNPACK");
212212
}
213213

214214
@Test
@@ -423,7 +423,7 @@ void unpackLibrariesTakePrecedenceOverExistingSourceEntries() throws Exception {
423423
this.testJarFile.addClass("A.class", ClassWithMainMethod.class);
424424
P packager = createPackager();
425425
execute(packager, (callback) -> callback.library(newLibrary(nestedFile, LibraryScope.COMPILE, true)));
426-
assertThat(getPackagedEntry(name).getComment()).startsWith("UNPACK:");
426+
assertThat(getPackagedEntry(name).getComment()).isEqualTo("UNPACK");
427427
}
428428

429429
@Test
@@ -538,7 +538,7 @@ void existingEntryThatMatchesUnpackLibraryIsMarkedForUnpack() throws IOException
538538
assertThat(getPackagedEntryNames()).containsSubsequence("org/springframework/boot/loader/",
539539
"WEB-INF/classes/com/example/Application.class", "WEB-INF/lib/" + library.getName());
540540
ZipEntry unpackLibrary = getPackagedEntry("WEB-INF/lib/" + library.getName());
541-
assertThat(unpackLibrary.getComment()).startsWith("UNPACK:");
541+
assertThat(unpackLibrary.getComment()).isEqualTo("UNPACK");
542542
}
543543

544544
@Test

loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/launch/JarFileArchive.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
*/
4949
class JarFileArchive implements Archive {
5050

51-
private static final String UNPACK_MARKER = "UNPACK:";
51+
private static final String UNPACK_MARKER = "UNPACK";
5252

5353
private static final FileAttribute<?>[] NO_FILE_ATTRIBUTES = {};
5454

loader/spring-boot-loader/src/test/java/org/springframework/boot/loader/testsupport/TestJar.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ private static void writeNestedEntry(String name, boolean unpackNested, JarOutpu
9090
nestedEntry.setSize(nestedJarData.length);
9191
nestedEntry.setCompressedSize(nestedJarData.length);
9292
if (unpackNested) {
93-
nestedEntry.setComment("UNPACK:0000000000000000000000000000000000000000");
93+
nestedEntry.setComment("UNPACK");
9494
}
9595
CRC32 crc32 = new CRC32();
9696
crc32.update(nestedJarData);

0 commit comments

Comments
 (0)