This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/causeway.git
The following commit(s) were added to refs/heads/master by this push:
new 7bcd08879d CAUSEWAY-3404: FileUtils.searchFiles(...) don't force
consumers to catch
7bcd08879d is described below
commit 7bcd08879d0c477f0d8780148b195b44cac8e9fb
Author: Andi Huber <[email protected]>
AuthorDate: Tue Feb 13 07:11:17 2024 +0100
CAUSEWAY-3404: FileUtils.searchFiles(...) don't force consumers to catch
- aligns with the most common paradigm of our utilities
---
.../src/main/java/org/apache/causeway/commons/io/FileUtils.java | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git
a/commons/src/main/java/org/apache/causeway/commons/io/FileUtils.java
b/commons/src/main/java/org/apache/causeway/commons/io/FileUtils.java
index 3b7d21046d..0eadb5a2c4 100644
--- a/commons/src/main/java/org/apache/causeway/commons/io/FileUtils.java
+++ b/commons/src/main/java/org/apache/causeway/commons/io/FileUtils.java
@@ -22,7 +22,6 @@ import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
-import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.nio.file.DirectoryStream;
@@ -102,12 +101,11 @@ public class FileUtils {
* @param dirFilter
* @param fileFilter
* @return set of matching files
- * @throws IOException
*/
public Set<File> searchFiles(
final File dir,
final Predicate<File> dirFilter,
- final Predicate<File> fileFilter) throws IOException {
+ final Predicate<File> fileFilter) {
final Set<File> fileList = new LinkedHashSet<>();
searchFiles(dir, dirFilter, fileFilter, fileList::add);
return fileList;
@@ -121,13 +119,13 @@ public class FileUtils {
* @param dirFilter
* @param fileFilter
* @param onFileFound
- * @throws IOException
*/
+ @SneakyThrows
public void searchFiles(
final File dir,
final Predicate<File> dirFilter,
final Predicate<File> fileFilter,
- final Consumer<File> onFileFound) throws IOException {
+ final Consumer<File> onFileFound) {
if(!dir.exists()) {
return;
}