pnever 2003/12/04 09:31:38
Modified: src/webdav/server/org/apache/slide/webdav/method
PutMethod.java
Log:
Fixed problem identified by testcase
functional\extra\put\code\put409.xml
Revision Changes Path
1.68 +21 -4
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PutMethod.java
Index: PutMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PutMethod.java,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- PutMethod.java 5 Nov 2003 14:24:34 -0000 1.67
+++ PutMethod.java 4 Dec 2003 17:31:38 -0000 1.68
@@ -70,6 +70,7 @@
import org.apache.slide.common.ServiceAccessException;
import org.apache.slide.common.SlideException;
import org.apache.slide.common.SlideToken;
+import org.apache.slide.common.UriPath;
import org.apache.slide.content.NodeProperty;
import org.apache.slide.content.NodeRevisionContent;
import org.apache.slide.content.NodeRevisionDescriptor;
@@ -95,6 +96,7 @@
import org.apache.slide.webdav.util.resourcekind.CheckedInVersionControlled;
import org.apache.slide.webdav.util.resourcekind.ResourceKind;
import org.apache.util.WebdavStatus;
+import org.apache.slide.security.AccessDeniedException;
/**
* PUT method.
@@ -328,8 +330,23 @@
sendError( statusCode, e );
throw new WebdavException( statusCode );
} catch (ObjectNotFoundException e) {
+ // check parent exists
+ UriPath upath = new UriPath(resourcePath);
+ try {
+ structure.retrieve(slideToken, upath.parent().toString());
+ }
+ catch (ObjectNotFoundException x) {
+ throw new PreconditionViolationException(
+ new ViolatedPrecondition("parent-collection-must-exist",
+ WebdavStatus.SC_CONFLICT,
+ "Parent collection
"+upath.parent().toString()+" not found"),
+ resourcePath
+ );
+ }
+ catch (SlideException x) {
+ throw x;
+ }
- // Todo : Check to see if parent exists
SubjectNode subject = new SubjectNode();
// Creating an object
structure.create(slideToken, subject, resourcePath);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]