Skip to content

Commit

Permalink
fix: close JarFiles opened by ConformanceTestLocator (#662)
Browse files Browse the repository at this point in the history
  • Loading branch information
BenWhitehead authored Oct 8, 2024
1 parent 82a5acf commit 3b7da93
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,13 @@ private static List<String> handleJarScheme(final URL url, MatchPattern mp) thro
final String jarPath = urlPath.substring(5, urlPath.indexOf("!"));

final List<String> resourcePaths = new ArrayList<>();
final JarFile jarFile = new JarFile(jarPath);
final Enumeration<JarEntry> jarEntries = jarFile.entries();
while (jarEntries.hasMoreElements()) {
JarEntry je = jarEntries.nextElement();
if (!je.isDirectory() && mp.matches(je.getName())) {
resourcePaths.add(je.getName());
try (final JarFile jarFile = new JarFile(jarPath)) {
final Enumeration<JarEntry> jarEntries = jarFile.entries();
while (jarEntries.hasMoreElements()) {
JarEntry je = jarEntries.nextElement();
if (!je.isDirectory() && mp.matches(je.getName())) {
resourcePaths.add(je.getName());
}
}
}
return resourcePaths;
Expand Down

0 comments on commit 3b7da93

Please sign in to comment.