You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by un...@apache.org on 2004/06/28 12:10:04 UTC
cvs commit: cocoon-2.1/src/blocks/webdav/java/org/apache/cocoon/components/source/impl WebDAVSource.java
unico 2004/06/28 03:10:04
Modified: src/blocks/webdav/java/org/apache/cocoon/components/source/impl
WebDAVSource.java
Log:
makeCollection() should act like File.mkdirs, ie any non-existent parent collectinos should be created as well.
fix bug in getParent() that in some circumstances it returned itself as its parent
Revision Changes Path
1.29 +9 -4 cocoon-2.1/src/blocks/webdav/java/org/apache/cocoon/components/source/impl/WebDAVSource.java
Index: WebDAVSource.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/webdav/java/org/apache/cocoon/components/source/impl/WebDAVSource.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- WebDAVSource.java 13 Apr 2004 17:13:29 -0000 1.28
+++ WebDAVSource.java 28 Jun 2004 10:10:04 -0000 1.29
@@ -602,8 +602,8 @@
* @see org.apache.excalibur.source.TraversableSource#getParent()
*/
public Source getParent() throws SourceException {
- String path = isCollection()?"..":".";
-
+ initResource(WebdavResource.BASIC, DepthSupport.DEPTH_0);
+ String path = this.resource.isCollection()?"..":".";
try {
HttpURL parentURL;
if (url instanceof HttpsURL) {
@@ -749,8 +749,13 @@
try {
if (!this.resource.mkcolMethod()) {
int status = this.resource.getStatusCode();
+ if (status == 409) {
+ // parent does not exist, create it and try again
+ ((ModifiableTraversableSource) getParent()).makeCollection();
+ makeCollection();
+ }
// Ignore status 405 - Not allowed: collection already exists
- if (status != 405) {
+ else if (status != 405) {
final String msg =
"Unable to create collection " + getSecureURI()
+ ". Server responded " + this.resource.getStatusCode()