United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6907737 : (file) FileVisitor and Files.walkFileTree issues

Details
Type:
Bug
Submit Date:
2009-12-06
Status:
Closed
Updated Date:
2011-03-08
Project Name:
JDK
Resolved Date:
2011-03-08
Component:
core-libs
OS:
generic
Sub-Component:
java.nio
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:

Related Reports
Duplicate:
Duplicate:
Relates:
Relates:

Sub Tasks

Description
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.

                                    
                                
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.

                                    

Comments
EVALUATION

See description.
                                     
2010-01-10
EVALUATION

See description.
                                     
2010-01-10



Hardware and Software, Engineered to Work Together