diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryFileHeader.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryFileHeader.java index ca7bae40c2fb..e1f3efd17b0d 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryFileHeader.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryFileHeader.java @@ -153,6 +153,10 @@ public byte[] getExtra() { return this.extra; } + public boolean hasExtra() { + return this.extra.length > 0; + } + public AsciiBytes getComment() { return this.comment; } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntry.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntry.java index aed07d1bc70e..1c69dbaa1e8b 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntry.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntry.java @@ -56,7 +56,9 @@ class JarEntry extends java.util.jar.JarEntry implements FileHeader { setComment(header.getComment().toString()); setSize(header.getSize()); setTime(header.getTime()); - setExtra(header.getExtra()); + if (header.hasExtra()) { + setExtra(header.getExtra()); + } } AsciiBytes getAsciiBytesName() {