8012930: (fs) Eliminate recursion from FileTreeWalker

Chris Hegarty chris.hegarty at oracle.com
Tue Apr 23 06:35:26 PDT 2013


Wow Alan, very nice.

The webrev is a little difficult to see what has changed in 
FileTreeWalker because some parts have moved, but nothing jumps out at me.

The additional test, and the moving of other tests out from under a 
script is welcome.

-Chris.

On 04/23/2013 10:12 AM, Alan Bateman wrote:
>
> This patch eliminates the recursion from the FileTreeWalker utility
> class used by Files.walkFileTree, replacing it with its own walking
> stack.  While stack overflow hasn't been a problem, it can be mildly
> annoying to see a lot of walk methods in the stack trace when an
> exception occurs when deep in the file system. The other motivation of
> course is that the events make it more generally useful, particularly
> with the proposed API additions that flatten the nodes to a stream. With
> the change then FileTreeWalker will simply provide a sequence of events
> corresponding to the files in the tree; the dispatching to FileVisitor
> methods is moved to Files.walkFileTree.
>
> The other thing in this patch is splitting out of the tests from the
> walk_file_tree.sh test. This shell test was originally intended to test
> walkFileTree against the native "find" program but it ended up running
> several other tests. It also turns out that SKIP_SUBTREE wasn't being
> tested so I've added a simple test for that.
>
> The webrev with the changes is here:
>
> http://cr.openjdk.java.net/~alanb/8012930/webrev
>
> Thanks,
>
> -Alan.


More information about the nio-dev mailing list