Skip to content

Commit 5c1055d

Browse files
committed
Merge branch '2.2.x' into 2.3.x
2 parents 409743e + 195def0 commit 5c1055d

File tree

2 files changed

+9
-5
lines changed
  • spring-boot-project/spring-boot-tools/spring-boot-loader/src

2 files changed

+9
-5
lines changed

spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFileEntries.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,11 +360,12 @@ JarEntryCertification getCertification(JarEntry entry) throws IOException {
360360
try (JarInputStream certifiedJarStream = new JarInputStream(this.jarFile.getData().getInputStream())) {
361361
java.util.jar.JarEntry certifiedEntry = null;
362362
while ((certifiedEntry = certifiedJarStream.getNextJarEntry()) != null) {
363+
// Entry must be closed to trigger a read and set entry certificates
364+
certifiedJarStream.closeEntry();
363365
int index = getEntryIndex(certifiedEntry.getName());
364366
if (index != -1) {
365367
certifications[index] = JarEntryCertification.from(certifiedEntry);
366368
}
367-
certifiedJarStream.closeEntry();
368369
}
369370
}
370371
this.certifications = certifications;

spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/JarFileTests.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,10 +437,13 @@ void verifySignedJar() throws Exception {
437437
while (actualEntries.hasMoreElements()) {
438438
JarEntry actualEntry = actualEntries.nextElement();
439439
java.util.jar.JarEntry expectedEntry = expected.getJarEntry(actualEntry.getName());
440-
assertThat(actualEntry.getCertificates()).as(actualEntry.getName())
441-
.isEqualTo(expectedEntry.getCertificates());
442-
assertThat(actualEntry.getCodeSigners()).as(actualEntry.getName())
443-
.isEqualTo(expectedEntry.getCodeSigners());
440+
StreamUtils.drain(expected.getInputStream(expectedEntry));
441+
if (!actualEntry.getName().equals("META-INF/MANIFEST.MF")) {
442+
assertThat(actualEntry.getCertificates()).as(actualEntry.getName())
443+
.isEqualTo(expectedEntry.getCertificates());
444+
assertThat(actualEntry.getCodeSigners()).as(actualEntry.getName())
445+
.isEqualTo(expectedEntry.getCodeSigners());
446+
}
444447
}
445448
assertThat(stopWatch.getTotalTimeSeconds()).isLessThan(3.0);
446449
}

0 commit comments

Comments
 (0)