-
Bug
-
Resolution: Fixed
-
P3
-
7
-
b114
-
generic
-
generic
-
Verified
This bug is tracking the following issues with Files.walkFileTree that need to fixed:
1. The visit* methods defined by FileVisitor will typically do I/O operations but cannot currently throw IOException.
2. The 4-arg walkFileTree method has a maxDepth parameter but doesn't clearly specify the behavior when at maxDepth. In particular it does not specify how directories at maxDepth should be handled.
3. When following symbolic links then walkFileTree will detect and report cycles to the FileVisitor's visitFile method. On further analysis, and necessary once the spec issue with the maxDepth is addressed, cycles should instead be treated as errors and the visitFileFailed method invoked instead.
4. FileVisitOption.DETECT_LOOPS is no longer required. The FOLLOW_LINKS option requires that cycles be detected and reported.
5. For consistency reasons, the preVisitDirectory method should provide the directory attributes. This will also potentially help the performance of applications that require the directory attributes during iteration.
6. The preVisitDirectoryFailed method is surplus to requirements and forces developers to put error handling in this and the visitFileFailed method. On further examination, the API would be simpler if the preVisitDirectoryFailed is removed and the vistFileFailed method invoked for all cases where a file could not be visited.
1. The visit* methods defined by FileVisitor will typically do I/O operations but cannot currently throw IOException.
2. The 4-arg walkFileTree method has a maxDepth parameter but doesn't clearly specify the behavior when at maxDepth. In particular it does not specify how directories at maxDepth should be handled.
3. When following symbolic links then walkFileTree will detect and report cycles to the FileVisitor's visitFile method. On further analysis, and necessary once the spec issue with the maxDepth is addressed, cycles should instead be treated as errors and the visitFileFailed method invoked instead.
4. FileVisitOption.DETECT_LOOPS is no longer required. The FOLLOW_LINKS option requires that cycles be detected and reported.
5. For consistency reasons, the preVisitDirectory method should provide the directory attributes. This will also potentially help the performance of applications that require the directory attributes during iteration.
6. The preVisitDirectoryFailed method is surplus to requirements and forces developers to put error handling in this and the visitFileFailed method. On further examination, the API would be simpler if the preVisitDirectoryFailed is removed and the vistFileFailed method invoked for all cases where a file could not be visited.
- duplicates
-
JDK-6881499 (file) FileVisitor.preVisitDirectory should make the BasicFileAttributes available
-
- Closed
-
- relates to
-
JDK-7016704 TEST_BUG: java/nio/file/Files/walk_file_tree.sh fails with new version of find (lnx)
-
- Closed
-