Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
Apache Maven 3.0.3 (r1075438; 2011-02-28 12:31:09-0500)
Maven home: C:\Java\apache-maven-3.0.3\bin\..
Java version: 1.6.0_29, vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\jdk1.6.0_29\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"Apache Maven 3.0.3 (r1075438; 2011-02-28 12:31:09-0500) Maven home: C:\Java\apache-maven-3.0.3\bin\.. Java version: 1.6.0_29, vendor: Sun Microsystems Inc. Java home: C:\Program Files\Java\jdk1.6.0_29\jre Default locale: en_US, platform encoding: Cp1252 OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
Description
I see a lot of call sites within VFS 2 and some in my work server that do:
fileObject.delete(Selectors.SELECT_ALL);
It therefore seems like a sensible refactoring.
Add to FileObject:
/** * Deletes all descendents of this file. * Does nothing if this file does not exist. * Shorthand for {@code delete(Selectors.Selectors.SELECT_ALL)} * <p/> * <p>This method is not transactional. If it fails and throws an * exception, this file will potentially only be partially deleted. * * @return the number of deleted objects * @throws FileSystemException If this file or one of its descendents is read-only, or on error * deleting this file or one of its descendents. */ int deleteAll() throws FileSystemException;
And to AbstractFileObject:
/** * Deletes this file, and all children. * * @return the number of deleted files. * @throws FileSystemException if an error occurs. */ public int deleteAllDescendents() throws FileSystemException { return this.delete(Selectors.SELECT_ALL); }
Thoughts?
Attaching patch.