work with jar file before closing it

This commit is contained in:
fszimnau
2025-11-25 09:21:53 +01:00
parent 7df22a2d1f
commit 8be9cf81d7

View File

@@ -55,9 +55,6 @@ public class Main {
Enumeration<JarEntry> entries; Enumeration<JarEntry> entries;
try (var jarFile = new JarFile(URLDecoder.decode(cleanPath, StandardCharsets.UTF_8))) { try (var jarFile = new JarFile(URLDecoder.decode(cleanPath, StandardCharsets.UTF_8))) {
entries = jarFile.entries(); entries = jarFile.entries();
} catch (IOException e) {
throw new RuntimeException("Kann JAR-Datei zwecks Reflection nicht öffnen:", e);
}
while (entries.hasMoreElements()) { while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement(); JarEntry entry = entries.nextElement();
if (entry.isDirectory()) { if (entry.isDirectory()) {
@@ -65,6 +62,9 @@ public class Main {
} }
fileNames.add(entry.getName()); fileNames.add(entry.getName());
} }
} catch (IOException e) {
throw new RuntimeException("Kann JAR-Datei zwecks Reflection nicht öffnen:", e);
}
var increment = new AtomicInteger(); var increment = new AtomicInteger();
return Collections.unmodifiableSortedMap(new TreeMap<>( return Collections.unmodifiableSortedMap(new TreeMap<>(
fileNames.stream() fileNames.stream()