From cc3b8086d49f8e0e46383a73a0fd4e15bfa9fd99 Mon Sep 17 00:00:00 2001 From: Rawi01 Date: Thu, 19 Sep 2024 17:09:28 +0200 Subject: [PATCH] [fixes #3728] Remove signature files eclipse plugin jars --- .../DownloadEclipseDependencies.java | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/support/lombok/eclipse/dependencies/DownloadEclipseDependencies.java b/src/support/lombok/eclipse/dependencies/DownloadEclipseDependencies.java index 0e8d5895..0aa9934d 100644 --- a/src/support/lombok/eclipse/dependencies/DownloadEclipseDependencies.java +++ b/src/support/lombok/eclipse/dependencies/DownloadEclipseDependencies.java @@ -36,6 +36,9 @@ import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.List; import java.util.Set; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; +import java.util.zip.ZipOutputStream; /** * Download eclipse bundles. @@ -87,12 +90,22 @@ public class DownloadEclipseDependencies { return; } System.out.print("Downloading '" + filename + "'... "); - InputStream in = null; - OutputStream out = null; + ZipInputStream in = null; + ZipOutputStream out = null; try { - in = getStreamForUrl(repositoryUrl + filename); - out = new FileOutputStream(targetFile); - copy(in, out); + in = new ZipInputStream(getStreamForUrl(repositoryUrl + filename)); + out = new ZipOutputStream(new FileOutputStream(targetFile)); + + ZipEntry zipEntry; + while ((zipEntry = in.getNextEntry()) != null) { + String name = zipEntry.getName(); + + // Remove signature files + if (name.matches("META-INF/.*\\.(SF|RSA)")) continue; + + out.putNextEntry(new ZipEntry(name)); + copy(in, out); + } System.out.println("[done]"); } catch (IOException e) { System.out.println("[error]");