Exception in postVisitDirectory; how to trigger it
Directly from this API here is the description of postVisitDirectory method:
postVisitDirectory
FileVisitResult postVisitDirectory(T dir, IOException exc) throws IOException
Invoked for a directory after entries in the directory, and all of their
descendants, have been visited. This method is also invoked when iteration
of the directory completes prematurely (by a visitFile method returning
SKIP_SIBLINGS, or an I/O error when iterating over the directory).
I would like to test the last part of this description: "or an I/O error
when iterating over the directory".
This is my postVisitDirectory():
public FileVisitResult postVisitDirectory(Path dir, IOException io)
{
System.out.println(dir.getFileName());
if (io!=null)
{
System.err.println("IT IS NOT NULL!");
}
return FileVisitResult.CONTINUE;
}
I would like to trigger "IT IS NOT NULL" in the postVisitDirectory method.
Any idea? Thanks in advance.
No comments:
Post a Comment