[ http://issues.apache.org/jira/browse/IO-86?page=comments#action_12440737 
] 
            
Niall Pemberton commented on IO-86:
-----------------------------------

IMO using an Exception to control the cancellation process was a (slightly) 
more elegant way to implement that behaviour. It also provides a more 
extensible mechanism for cancellations originating from within DirectoryWalker 
- since it can be thrown from any of the methods and custom implementations of 
CancelledOperation can be used to pass additional information to the 
handleCancelled() method.

I envisaged two scenarios for cancellation - "externally" by another thread and 
"internally" from within a DirectoryWalker implementation. The isCancelled() 
method was solely for the former, but I'm starting to think that this doesn't 
add much (one dummy method and 2 checks) and it would be better to just let 
users put in cancelled checks and throw exceptions wherever they want. Doing 
this makes DirectoryWalker a simpler class - which is a good thing IMO.

What was the reason for replacing the use of an exception with a boolean - was 
it just stylistic or do you have reasons of substance? Anyway my preference 
would be to revert to (alomost) my original patch - without isCancelled() and 
the 2 checks.

Good point about exceptions - I think we should declare them on each method - 
then implementations can choose what to do with them when they implement a call 
to the top walk() method. limiting them to just IOExceptions seems narrow, 
since implementations may want to throw all sorts of exceptions, not just 
IOExceptions.

> Add DirectoryWalker based on FileFinder
> ---------------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, 
> io-DirectoryWalker-cancellation-2.patch, io-filefinder-start-end.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a 
> simplified version of what was recently moved out of Commons IO into the 
> "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder 
> component and therefore would be considered suitable for inclusion in Commons 
> IO. Although simpler it could be used as the basis for achieving the finder 
> component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to