in winegrower-core/src/main/java/org/apache/winegrower/deployer/BundleImpl.java [265:298]
public Enumeration<String> getEntryPaths(final String path) {
if (includedResources != null) {
return enumeration(includedResources.stream()
.filter(it -> it.startsWith(path))
.collect(toList()));
}
if (file.isDirectory()) {
final Path base = file.toPath().toAbsolutePath();
final Path subPath = new File(file, path == null ? "" : (path.startsWith("/") ? path.substring(1) : path)).toPath();
final Collection<String> paths = new ArrayList<>();
try {
Files.walkFileTree(subPath, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException {
if (file.toAbsolutePath().toString().startsWith(base.toString())) {
paths.add(base.relativize(file).toString());
}
return super.visitFile(file, attrs);
}
});
} catch (final IOException e) {
throw new IllegalStateException(e);
}
return enumeration(paths);
}
try (final JarFile jar = new JarFile(file)) {
return enumeration(list(jar.entries()).stream()
.filter(it -> it.getName().startsWith(path))
.map(ZipEntry::getName)
.collect(toList()));
} catch (final IOException e) {
throw new IllegalArgumentException(e);
}
}