walkFileTree() does not throw NPE for null FileVisitOption

Rajendra Gutupalli Rajendra.Gutupalli at Sun.COM
Fri Aug 8 02:56:18 PDT 2008


Hi Alan,

I added null value to the set of FileVisitOption and passed it as an 
argument to Files.walkFileTree(). Right now it works without throwing NPE.
Should the following code throw NPE or ignore null value?

 Set<FileVisitOption> visitOpts = new HashSet<FileVisitOption>();
 visitOpts.add(null);
 Files.walkFileTree(path, visitOpts, -1, new MyFileVisitor());

Usually if we pass array/set of open/copy options which contain null 
value then the respective method (moveTo/newSeekableChannel ..) throws NPE.

Thanks
Rajendra



More information about the nio-dev mailing list