diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootZipCopyAction.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootZipCopyAction.java index 0eb16258fb7d..7eeadbd84c8f 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootZipCopyAction.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootZipCopyAction.java @@ -348,11 +348,8 @@ private void writeJarToolsIfNecessary() throws IOException { private void writeJarModeLibrary(String location, JarModeLibrary library) throws IOException { String name = location + library.getName(); - writeEntry(name, ZipEntryContentWriter.fromInputStream(library.openStream()), false, (entry) -> { - try (InputStream in = library.openStream()) { - prepareStoredEntry(library.openStream(), false, entry); - } - }); + writeEntry(name, ZipEntryContentWriter.fromInputStream(library.openStream()), false, + (entry) -> prepareStoredEntry(library.openStream(), false, entry)); if (BootZipCopyAction.this.layerResolver != null) { Layer layer = BootZipCopyAction.this.layerResolver.getLayer(library); this.layerIndex.add(layer, name);