Bug 43593 - propFind method incorrectly parses namespaced string property names
Summary: propFind method incorrectly parses namespaced string property names
Status: NEW
Alias: None
Product: Slide
Classification: Unclassified
Component: WebDAV client (show other bugs)
Version: Nightly
Hardware: Macintosh Mac OS X 10.4
: P2 normal (vote)
Target Milestone: ---
Assignee: Slide Developer List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-10 14:04 UTC by Elliot Metsger
Modified: 2007-10-10 14:24 UTC (History)
0 users



Attachments
Fixes off-by-one error (820 bytes, patch)
2007-10-10 14:24 UTC, Elliot Metsger
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Elliot Metsger 2007-10-10 14:04:55 UTC
When WebdavResource.propfindMethod( String ) is called with a namespaced
property such as 'http://example.com/ns:customproperty', incorrect XML is sent
over the wire (note the extra colon at the end of the namespace):

<D:propfind xmlns:D="DAV:">
   <D:prop>
      <ZZ:customproperty xmlns:ZZ="http://example.com/ns:">
      </ZZ:customproperty>
   </D:prop>
</D:propfind>

Passing the property in as a Vector containing a PropertyName, the correct XML
is sent over the wire.

It seems like there is an off-by-one error in
PropFindMethod.setPropertyNames(Enumeration):

Index: clientlib/src/java/org/apache/webdav/lib/methods/PropFindMethod.java
===================================================================
--- clientlib/src/java/org/apache/webdav/lib/methods/PropFindMethod.java       
(revision 583601)
+++ clientlib/src/java/org/apache/webdav/lib/methods/PropFindMethod.java       
(working copy)
@@ -284,7 +284,7 @@
                 if ((i == 1) || (i >= length)) {
                     list.add(new PropertyName("DAV:",propertyName));
                 } else {
-                    String namespace = propertyName.substring(0, length + 1 - i);
+                    String namespace = propertyName.substring(0, length - i);
                     String localName = propertyName.substring(length + 1 - i);
                     list.add(new PropertyName(namespace,localName));
                 }

This patch seems to fix the issue, although it seems like this bit of code is
meant to deal nicely with multi-byte characters?
Comment 1 Elliot Metsger 2007-10-10 14:24:50 UTC
Created attachment 20952 [details]
Fixes off-by-one error

This is the same patch that is in the body of the bug description.