From af654e3478e62ff264f46a047b3611e7c7e5f88c Mon Sep 17 00:00:00 2001 From: Luis Nassif Date: Thu, 21 Sep 2023 18:54:28 -0300 Subject: [PATCH] '#1861: log error on console if files with invalid names are ignored --- .../iped/engine/datasource/FolderTreeReader.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/iped-engine/src/main/java/iped/engine/datasource/FolderTreeReader.java b/iped-engine/src/main/java/iped/engine/datasource/FolderTreeReader.java index 6179131f19..30341615c9 100644 --- a/iped-engine/src/main/java/iped/engine/datasource/FolderTreeReader.java +++ b/iped-engine/src/main/java/iped/engine/datasource/FolderTreeReader.java @@ -30,6 +30,9 @@ import java.util.LinkedList; import java.util.regex.Pattern; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import iped.data.ICaseData; import iped.data.IItem; import iped.engine.CmdLineArgs; @@ -45,6 +48,8 @@ public class FolderTreeReader extends DataSourceReader { public static final String FS_OWNER = "fileSystemOwner"; //$NON-NLS-1$ + private static final Logger logger = LoggerFactory.getLogger(FolderTreeReader.class); + private FileInputStreamFactory inputStreamFactory; private Pattern excludePattern; @@ -227,9 +232,7 @@ public FileVisitResult postVisitDirectory(Path path, IOException exception) thro parents.pollLast(); if (exception != null) { - System.err.println( - new Date() + "\t[WARN]\t" + "Directory ignored: " + path.toFile().getAbsolutePath() + " " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + exception.toString()); + logger.error("Directory ignored: " + path.toFile().getAbsolutePath() + ": " + exception.toString()); } return FileVisitResult.CONTINUE; @@ -239,8 +242,7 @@ public FileVisitResult postVisitDirectory(Path path, IOException exception) thro public FileVisitResult visitFileFailed(Path path, IOException exception) throws IOException { if (exception != null) { - System.err.println(new Date() + "\t[WARN]\t" + "File ignored: " + path.toFile().getAbsolutePath() + " " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + exception.toString()); + logger.error("File ignored: " + path.toFile().getAbsolutePath() + ": " + exception.toString()); } return FileVisitResult.CONTINUE;