Skip to content

Commit

Permalink
Optimize JarEntry construction
Browse files Browse the repository at this point in the history
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 spring-projectsgh-16620
  • Loading branch information
dreis2211 authored and wilkinsona committed Apr 23, 2019
1 parent fd14cd0 commit f40b086
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ public byte[] getExtra() {
return this.extra;
}

public boolean hasExtra() {
return this.extra.length > 0;
}

public AsciiBytes getComment() {
return this.comment;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit f40b086

Please sign in to comment.