Skip to content

Commit

Permalink
'#1861: log error on console if files with invalid names are ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
lfcnassif committed Sep 21, 2023
1 parent d3a5416 commit af654e3
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit af654e3

Please sign in to comment.