Skip to content

Commit 4138e59

Browse files
committed
Fix potential JarFileEntries ClassCastException
Update `JarFileEntries` so that the interface is obtained rather than the concrete implementation. This allows `JarEntry` values to be used without causing a ClassCastException. Closes gh-19041
1 parent 492e1a4 commit 4138e59

File tree

1 file changed

+1
-1
lines changed
  • spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ private int getEntryIndex(CharSequence name) {
370370
int hashCode = AsciiBytes.hashCode(name);
371371
int index = getFirstIndex(hashCode);
372372
while (index >= 0 && index < this.size && this.hashCodes[index] == hashCode) {
373-
CentralDirectoryFileHeader candidate = getEntry(index, CentralDirectoryFileHeader.class, false, null);
373+
FileHeader candidate = getEntry(index, FileHeader.class, false, null);
374374
if (candidate.hasName(name, NO_SUFFIX)) {
375375
return index;
376376
}

0 commit comments

Comments
 (0)