Skip to content

Commit 195def0

Browse files
committed
Merge branch '2.1.x' into 2.2.x
2 parents 5a26615 + e003009 commit 195def0

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
@@ -353,11 +353,12 @@ JarEntryCertification getCertification(JarEntry entry) throws IOException {
353353
try (JarInputStream certifiedJarStream = new JarInputStream(this.jarFile.getData().getInputStream())) {
354354
java.util.jar.JarEntry certifiedEntry = null;
355355
while ((certifiedEntry = certifiedJarStream.getNextJarEntry()) != null) {
356+
// Entry must be closed to trigger a read and set entry certificates
357+
certifiedJarStream.closeEntry();
356358
int index = getEntryIndex(certifiedEntry.getName());
357359
if (index != -1) {
358360
certifications[index] = JarEntryCertification.from(certifiedEntry);
359361
}
360-
certifiedJarStream.closeEntry();
361362
}
362363
}
363364
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
@@ -407,10 +407,13 @@ void verifySignedJar() throws Exception {
407407
while (actualEntries.hasMoreElements()) {
408408
JarEntry actualEntry = actualEntries.nextElement();
409409
java.util.jar.JarEntry expectedEntry = expected.getJarEntry(actualEntry.getName());
410-
assertThat(actualEntry.getCertificates()).as(actualEntry.getName())
411-
.isEqualTo(expectedEntry.getCertificates());
412-
assertThat(actualEntry.getCodeSigners()).as(actualEntry.getName())
413-
.isEqualTo(expectedEntry.getCodeSigners());
410+
StreamUtils.drain(expected.getInputStream(expectedEntry));
411+
if (!actualEntry.getName().equals("META-INF/MANIFEST.MF")) {
412+
assertThat(actualEntry.getCertificates()).as(actualEntry.getName())
413+
.isEqualTo(expectedEntry.getCertificates());
414+
assertThat(actualEntry.getCodeSigners()).as(actualEntry.getName())
415+
.isEqualTo(expectedEntry.getCodeSigners());
416+
}
414417
}
415418
assertThat(stopWatch.getTotalTimeSeconds()).isLessThan(3.0);
416419
}

0 commit comments

Comments
 (0)