|
1 | 1 | package org.utplsql.api; |
2 | 2 |
|
3 | | -import com.sun.nio.zipfs.ZipPath; |
4 | 3 | import org.utplsql.api.reporter.CoverageHTMLReporter; |
5 | 4 |
|
6 | 5 | import java.io.IOException; |
|
9 | 8 | import java.nio.file.*; |
10 | 9 | import java.util.ArrayList; |
11 | 10 | import java.util.Collections; |
12 | | -import java.util.Enumeration; |
13 | 11 | import java.util.List; |
14 | | -import java.util.zip.ZipEntry; |
15 | | -import java.util.zip.ZipFile; |
16 | 12 |
|
17 | 13 | /** |
18 | 14 | * Helper class for dealing with Resources |
@@ -61,26 +57,10 @@ public static List<Path> getListOfChildren(Path resourceAsPath, boolean filesOnl |
61 | 57 |
|
62 | 58 | final List<Path> result = new ArrayList<>(); |
63 | 59 |
|
64 | | - if (resourcePath instanceof ZipPath) { |
65 | | - try (ZipFile zf = new ZipFile(resourcePath.getFileSystem().toString())) { |
| 60 | + Files.walk(resourcePath) |
| 61 | + .filter(p -> !filesOnly || p.toFile().isFile()) |
| 62 | + .forEach(p -> result.add(p.subpath(relativeStartIndex, p.getNameCount()))); |
66 | 63 |
|
67 | | - for (Enumeration list = zf.entries(); list.hasMoreElements(); ) { |
68 | | - ZipEntry entry = (ZipEntry) list.nextElement(); |
69 | | - // Get entry-path with root element so we can compare it |
70 | | - Path entryPath = resourcePath.getRoot().resolve(resourcePath.getFileSystem().getPath(entry.toString())); |
71 | | - |
72 | | - if (entryPath.startsWith(resourcePath) && (!filesOnly || !entry.isDirectory())) { |
73 | | - result.add(entryPath.subpath(relativeStartIndex, entryPath.getNameCount())); |
74 | | - } |
75 | | - } |
76 | | - } |
77 | | - resourcePath.getFileSystem().close(); |
78 | | - } else { |
79 | | - Files.walk(resourcePath) |
80 | | - .filter(p -> !filesOnly || p.toFile().isFile()) |
81 | | - .forEach(p -> result.add(p.subpath(relativeStartIndex, p.getNameCount()))); |
82 | | - |
83 | | - } |
84 | 64 |
|
85 | 65 | return result; |
86 | 66 | } |
|
0 commit comments