[ http://jira.codehaus.org/browse/WAGON-110?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=262788#action_262788 ]
Oleg Estekhin commented on WAGON-110: ------------------------------------- When the WagonDirectoryScanner in the scandir(String,String) method tries to check whether the resource name denotes a directory, it tries to add a trailing '/' character to the resource name and asks Wagon.resourceExists to check whether a resource with such a name exists. If for any reason the Wagon or some underlying library will decide to remove the trailing '/' as part of some normalization process before checking for resource existance, the Wagon will return true from the resourceExists, and WagonDirectoryScanner will wrongly think it is a directory. The WagonDirectoryScanner.scandir obtains a list of files inside a direcotry by calling the Wagon.getFileList(). The getFileList's javadoc does not require that directories inside the returned list should have the trailing '/', but the WagonTestCase expects it to be so. Names that already have the trailing '/' are considered by the WagonDirectoryScanner.scandir and WagonDirectoryScanner.isDirectory to be directories without asking Wagon.resourceExists, but all other names in the list returned from the Wagon.getFileList will be checked by adding '/' and asking Wagon.resourceExists. Consider adding isDirectory(String):boolean method to the Wagon interface that will explicitely check whether the wagon treats the specified resource name as a directory or not. Anyway, the Wagon.getFileList javadoc should be updated to reflect that directory names should have the trailing '/'. > Support directory operations sanely. > ------------------------------------ > > Key: WAGON-110 > URL: http://jira.codehaus.org/browse/WAGON-110 > Project: Maven Wagon > Issue Type: Improvement > Components: wagon-provider-api > Reporter: Luke Daley > Fix For: 1.x > > > The {{Wagon}} provider API is confused for directory operations. To simplify, > I propose a new interface be created (e.g. {{DirectoryWagon}}) that wagons > can implement... > {code} > bool isDirectory(String path) throws TransferFailedException, > ResourceDoesNotExistException, AuthorizationException; > String[] getFileList(String path) throws TransferFailedException, > ResourceDoesNotExistException, AuthorizationException; > void mkdir(String path) throws TransferFailedException, > ResourceDoesNotExistException, AuthorizationException; > void mkdirs(String path) throw throws TransferFailedException, > ResourceDoesNotExistException, AuthorizationException; > {code} > This would also require removing all directory related methods from the > {{Wagon}} interface. The {{AbstractWagon}} implementation could > _transparently_ use the primitives from the {{DirectoryWagon}} interface (if > implemented) to handle directory operations. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira