Skip to content

Commit d0b4dab

Browse files
committed
Merge pull request #16620 from Christoph Dreis
* gh-16620: Optimize JarEntry construction Closes gh-16620
2 parents 2799018 + f40b086 commit d0b4dab

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ public byte[] getExtra() {
153153
return this.extra;
154154
}
155155

156+
public boolean hasExtra() {
157+
return this.extra.length > 0;
158+
}
159+
156160
public AsciiBytes getComment() {
157161
return this.comment;
158162
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ class JarEntry extends java.util.jar.JarEntry implements FileHeader {
5656
setComment(header.getComment().toString());
5757
setSize(header.getSize());
5858
setTime(header.getTime());
59-
setExtra(header.getExtra());
59+
if (header.hasExtra()) {
60+
setExtra(header.getExtra());
61+
}
6062
}
6163

6264
AsciiBytes getAsciiBytesName() {

0 commit comments

Comments
 (0)