adammurdoch 2003/03/13 19:48:14 Modified: vfs/src/java/org/apache/commons/vfs Resources.properties vfs/src/java/org/apache/commons/vfs/provider/webdav WebdavFileObject.java Log: Handle non-DAV resources a little better. Revision Changes Path 1.23 +2 -2 jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/Resources.properties Index: Resources.properties =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/Resources.properties,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- Resources.properties 24 Feb 2003 07:24:58 -0000 1.22 +++ Resources.properties 14 Mar 2003 03:48:14 -0000 1.23 @@ -142,8 +142,8 @@ # WebDAV provider vfs.provider.webdav/write-file.error=Write to file failed with message: "{0}". -vfs.provider.webdav/list-children.error=Could not list child resources. -vfs.provider.webdav/create-collection.error=Creat collection failed with message: "{0}". +vfs.provider.webdav/list-children.error=List child resources failed with message: "{0}". +vfs.provider.webdav/create-collection.error=Create collection failed with message: "{0}". vfs.provider.webdav/delete-file.error=Delete file failed with message: "{0}". vfs.provider.webdav/create-client.error=Could not create client for server "{0}". 1.6 +12 -3 jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java Index: WebdavFileObject.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- WebdavFileObject.java 23 Feb 2003 00:40:39 -0000 1.5 +++ WebdavFileObject.java 14 Mar 2003 03:48:14 -0000 1.6 @@ -106,7 +106,7 @@ * Determines the type of the file, returns null if the file does not * exist. * - * @todo Bail if file is not a DAV resource + * @todo Shouldn't need 2 trips to the server to determine type. */ protected FileType doGetType() throws Exception { @@ -120,6 +120,7 @@ } resource.getHttpURL().setPath( optionsMethod.getPath() ); + // Resource exists if we can do a GET on it boolean exists = false; for ( Enumeration enum = optionsMethod.getAllowedMethods(); enum.hasMoreElements(); ) { @@ -135,6 +136,14 @@ return FileType.IMAGINARY; } + // Check if the resource is a DAV resource + final boolean davResource = optionsMethod.getDavCapabilities().hasMoreElements(); + if ( !davResource ) + { + // Assume a folder, and don't get the properties + return FileType.FOLDER; + } + // Get the properties of the resource resource.setProperties( WebdavResource.DEFAULT, 1 ); if ( resource.isCollection() ) @@ -155,7 +164,7 @@ final String[] children = resource.list(); if ( children == null ) { - throw new FileSystemException( "vfs.provider.webdav/list-children.error" ); + throw new FileSystemException( "vfs.provider.webdav/list-children.error", resource.getStatusMessage() ); } return children; }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]