Improve loading of jar entry certificates
Co-Authored-By: Phillip Webb <phil.webb@broadcom.com>
This commit is contained in:
@@ -666,6 +666,26 @@ class JarFileTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void mismatchedStreamEntriesThrowsException() throws IOException {
|
||||
File mismatchJar = new File("src/test/resources/jars/mismatch.jar");
|
||||
IllegalStateException failure = null;
|
||||
try (JarFile jarFile = new JarFile(mismatchJar)) {
|
||||
JarFile nestedJarFile = jarFile.getNestedJarFile(jarFile.getJarEntry("inner.jar"));
|
||||
Enumeration<JarEntry> entries = nestedJarFile.entries();
|
||||
while (entries.hasMoreElements()) {
|
||||
try {
|
||||
entries.nextElement().getCodeSigners();
|
||||
}
|
||||
catch (IllegalStateException ex) {
|
||||
failure = (failure != null) ? failure : ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
assertThat(failure)
|
||||
.hasMessage("Content mismatch when reading security info for entry 'content' (content check)");
|
||||
}
|
||||
|
||||
private File createJarFileWithEpochTimeOfZero() throws Exception {
|
||||
File jarFile = new File(this.tempDir, "temp.jar");
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(jarFile);
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user