jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Stocker (JIRA)" <j...@apache.org>
Subject [jira] Created: (JCR-2884) query.setOffset() with davex protocol doesn't work
Date Tue, 08 Feb 2011 13:30:57 GMT
query.setOffset() with davex protocol doesn't work
--------------------------------------------------

                 Key: JCR-2884
                 URL: https://issues.apache.org/jira/browse/JCR-2884
             Project: Jackrabbit Content Repository
          Issue Type: Bug
          Components: jackrabbit-webdav
    Affects Versions: 2.2.2, 2.3.0
            Reporter: Christian Stocker


Hi all


As you maybe know, we're building a PHP Library for interfacing with jackrabbit via davex
(it's called Jackalope :)). We are running now into an issue, that setOffset() doesn't work
and I found the problem (but don't have a proper fix):

The HTTP request looks like this:


<D:searchrequest xmlns:D="DAV:">
	<JCR-SQL2>SELECT * FROM [nt:unstructured] ORDER BY [jcr:path]</JCR-SQL2>
	<D:limit>
		<D:nresults>5</D:nresults>
		<offset>2</offset>
	</D:limit>
</D:searchrequest>

<offset> doesn't have a namespace, looking at the code, where that is generated, this
seems to be intentional in
jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/search/SearchInfo.java line 209

***
  if (offset != OFFSET_UNDEFINED) {
                // TODO define reasonable namespace...
                DomUtil.addChildElement(limitE, OFFSET, Namespace.EMPTY_NAMESPACE, offset
+ "");
   }
***

(but see the TODO in there)

In the same file on Line 259 it tries to get the element with
***
   // try of an offset is defined within the DAV:limit element.
            String offset = DomUtil.getChildTextTrim(limit, OFFSET, Namespace.EMPTY_NAMESPACE);
            if (offset != null) {
                try {
                    sInfo.setOffset(Long.valueOf(offset));
                } catch (NumberFormatException e) {
                    log.error("'offset' cannot be parsed into a long -> ignore.");
                }
            }
***

but that fails, it never finds the element. When I change the Namespace.EMPTY_NAMESPACE to
NAMESPACE (which is "DAV:") on both sides, then it works as expected.

There must be an error somewhere in DomUtil.getChildTextTrim() with empty namespaces, but
I can't find it with my little Java knowledge.

Does anyone have a solution? Adding a namespace (like mentioned in the TODO), which is the
easy fix, but fixing DomUtil.getChildTextTrim() would certainly be the better option.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message