Browse Source

Optimize JarEntry construction

This commit avoids calling the underlying ZipEntry.setExtra() method
that is not very inline friendly in cases where there is no extra
information to be set.

See gh-16620
pull/16632/head
dreis2211 7 years ago committed by Andy Wilkinson
parent
commit
f40b086ef5
  1. 4
      spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryFileHeader.java
  2. 4
      spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntry.java

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

@ -153,6 +153,10 @@ final class CentralDirectoryFileHeader implements FileHeader { @@ -153,6 +153,10 @@ final class CentralDirectoryFileHeader implements FileHeader {
return this.extra;
}
public boolean hasExtra() {
return this.extra.length > 0;
}
public AsciiBytes getComment() {
return this.comment;
}

4
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 { @@ -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() {

Loading…
Cancel
Save