Skip to content

Commit ee4def7

Browse files
ensure unsigned Manifest file stream is closed
1 parent b7ea4e6 commit ee4def7

File tree

1 file changed

+7
-7
lines changed
  • build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/dependencies/patches

1 file changed

+7
-7
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/dependencies/patches/Utils.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,13 @@ public static void patchJar(File inputFile, File outputFile, Collection<PatcherI
109109
);
110110
}
111111
} else {
112-
if (unsignJar && entryName.equals("META-INF/MANIFEST.MF")) {
113-
var manifest = new Manifest(jarFile.getInputStream(entry));
114-
manifest.getEntries().clear();
115-
manifest.write(jos);
116-
} else if (unsignJar == false || entryName.matches("META-INF/.*\\.SF") == false) {
117-
// Read the entry's data and write it to the new JAR
118-
try (InputStream is = jarFile.getInputStream(entry)) {
112+
try (InputStream is = jarFile.getInputStream(entry)) {
113+
if (unsignJar && entryName.equals("META-INF/MANIFEST.MF")) {
114+
var manifest = new Manifest(is);
115+
manifest.getEntries().clear();
116+
manifest.write(jos);
117+
} else if (unsignJar == false || entryName.matches("META-INF/.*\\.SF") == false) {
118+
// Read the entry's data and write it to the new JAR
119119
is.transferTo(jos);
120120
}
121121
}

0 commit comments

Comments
 (0)