You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Christian Stocker (JIRA)" <ji...@apache.org> on 2011/02/08 14:30:57 UTC

[jira] Created: (JCR-2884) query.setOffset() with davex protocol doesn't work

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

        

[jira] Updated: (JCR-2884) query.setOffset() with davex protocol doesn't work

Posted by "angela (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-2884?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

angela updated JCR-2884:
------------------------

    Component/s:     (was: jackrabbit-webdav)
                 jackrabbit-spi2dav

> 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-spi2dav
>    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

        

[jira] Resolved: (JCR-2884) query.setOffset() with davex protocol doesn't work

Posted by "angela (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-2884?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

angela resolved JCR-2884.
-------------------------

    Resolution: Duplicate

duplicate of JCR-2543

> 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