allow more exceptions to get displayed

This commit is contained in:
moehreag 2024-06-04 12:58:54 +02:00
parent 75b6efdc51
commit 75607fc7fe
2 changed files with 15 additions and 20 deletions

View file

@ -12,30 +12,26 @@ import java.util.List;
import java.util.function.Predicate; import java.util.function.Predicate;
public class Discovery { public class Discovery {
public static Collection<Path> find(Path start, Predicate<Path> directoryFilter, Predicate<Path> fileFilter) { public static Collection<Path> find(Path start, Predicate<Path> directoryFilter, Predicate<Path> fileFilter) throws IOException {
List<Path> paths = new ArrayList<>(); List<Path> paths = new ArrayList<>();
try { Files.walkFileTree(start, new SimpleFileVisitor<>() {
Files.walkFileTree(start, new SimpleFileVisitor<>() {
@Override @Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
if (directoryFilter.test(dir)) { if (directoryFilter.test(dir)) {
return super.preVisitDirectory(dir, attrs); return super.preVisitDirectory(dir, attrs);
}
return FileVisitResult.SKIP_SUBTREE;
} }
return FileVisitResult.SKIP_SUBTREE;
}
@Override @Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
if (fileFilter.test(file)) { if (fileFilter.test(file)) {
paths.add(file); paths.add(file);
}
return super.visitFile(file, attrs);
} }
}); return super.visitFile(file, attrs);
} catch (IOException e) { }
// TODO error handling. });
}
return paths; return paths;
} }
} }

View file

@ -116,7 +116,6 @@ public class FrogLoaderImpl implements FrogLoader {
}); });
if (plugins.isEmpty()) { if (plugins.isEmpty()) {
// TODO display error
throw new IllegalStateException("No plugin applicable to the current state was found!"); throw new IllegalStateException("No plugin applicable to the current state was found!");
} }
} }