Skip to content

Commit

Permalink
Fix double creation of Manifest file
Browse files Browse the repository at this point in the history
  • Loading branch information
mhalbritter committed Dec 14, 2023
1 parent 0274eee commit 5f7321a
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.springframework.boot.jarmode.layertools.JarStructure.Entry;
import org.springframework.util.Assert;
import org.springframework.util.StreamUtils;
import org.springframework.util.StringUtils;

/**
* Hacking.
Expand Down Expand Up @@ -89,11 +90,11 @@ protected void run(Map<Option, String> options, List<String> parameters) {
}
else {
JarEntry jarEntry = createJarEntry(resolvedEntry, zipEntry);
output.putNextEntry(jarEntry);
if (!zipEntry.isDirectory()) {
if (jarEntry != null) {
output.putNextEntry(jarEntry);
StreamUtils.copy(zip, output);
output.closeEntry();
}
output.closeEntry();
}
}
zipEntry = zip.getNextEntry();
Expand Down Expand Up @@ -144,6 +145,9 @@ private void write(ZipInputStream zip, ZipEntry entry, Path destination, String
}

private static JarEntry createJarEntry(Entry resolvedEntry, ZipEntry originalEntry) {
if (!StringUtils.hasLength(resolvedEntry.location())) {
return null;
}
JarEntry jarEntry = new JarEntry(resolvedEntry.location());
FileTime lastModifiedTime = originalEntry.getLastModifiedTime();
if (lastModifiedTime != null) {
Expand Down

0 comments on commit 5f7321a

Please sign in to comment.