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,16 +55,16 @@ 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();
while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
if (entry.isDirectory()) {
continue;
}
fileNames.add(entry.getName());
}
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException("Kann JAR-Datei zwecks Reflection nicht öffnen:", e); throw new RuntimeException("Kann JAR-Datei zwecks Reflection nicht öffnen:", e);
} }
while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
if (entry.isDirectory()) {
continue;
}
fileNames.add(entry.getName());
}
var increment = new AtomicInteger(); var increment = new AtomicInteger();
return Collections.unmodifiableSortedMap(new TreeMap<>( return Collections.unmodifiableSortedMap(new TreeMap<>(
fileNames.stream() fileNames.stream()