Bug 11658 - Locking a non-existing resource
Summary: Locking a non-existing resource
Status: RESOLVED FIXED
Alias: None
Product: Slide
Classification: Unclassified
Component: WebDAV client (show other bugs)
Version: 1.0.16 Stable
Hardware: All All
: P3 major (vote)
Target Milestone: ---
Assignee: Slide Developer List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-08-13 12:22 UTC by Ravindra
Modified: 2007-03-29 12:35 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ravindra 2002-08-13 12:22:39 UTC
When a non-existing resource is locked, server response is 201 with a 
lockDiscovery property in XML response body. WebDAV client always expects a 200 
or 207 response and does not handle 201. If we modify parseResponse() method of 
LockMethod class as follows everything works fine:

==============================
public void parseResponse(InputStream input)
        throws IOException, HttpException {
if (status == HttpStatus.SC_OK ||
-            status == HttpStatus.SC_MULTI_STATUS ) {
+            status == HttpStatus.SC_MULTI_STATUS ||
+            status == HttpStatus.SC_CREATED ) {
            parseXMLResponse(input);
-           if ( (status == HttpStatus.SC_OK) &&
+           if ( (status != HttpStatus.SC_MULTI_STATUS) &&
-              (this.state instanceof WebdavState)) {
                String prefix = DOMUtils.findDavPrefix(
===================================
I have tested this patch with IIS.

Thanks
-ravi
Comment 1 Ravindra 2002-08-13 12:26:38 UTC
sorry, summary was not correct. Now its correct.
Comment 2 Ravindra 2002-08-13 12:31:37 UTC
We need to verify the instanceof state also, mistakenly removed that line :(
Now patch is fine.
==============================
public void parseResponse(InputStream input)
        throws IOException, HttpException {
if (status == HttpStatus.SC_OK ||
-            status == HttpStatus.SC_MULTI_STATUS ) {
+            status == HttpStatus.SC_MULTI_STATUS ||
+            status == HttpStatus.SC_CREATED ) {
            parseXMLResponse(input);
-           if ( (status == HttpStatus.SC_OK) &&
+           if ( (status != HttpStatus.SC_MULTI_STATUS) &&
               (this.state instanceof WebdavState)) {
                String prefix = DOMUtils.findDavPrefix(
===================================
Comment 3 Martin van den Bemt 2007-03-29 12:35:28 UTC
This seems to be fixed in current trunk as well (at least first part of the
patch is the same as in source, although code is quite different after the
parseXmlResponse(input). Please reopen if you disagree.