AnsweredAssumed Answered

Query with skipCount

Question asked by karstene on Sep 14, 2012
Latest reply on Jul 5, 2013 by goebel
Hello,

I receive a strange Java error when I call the query function with a skipCount setting other than 0. To avoid any errors in my own code, I tried a query in the OpenCMIS 0.7 client, and I get the same error.

This is the code (using the Groovy Console):

import org.apache.chemistry.opencmis.commons.*
import org.apache.chemistry.opencmis.commons.data.*
import org.apache.chemistry.opencmis.commons.enums.*
import org.apache.chemistry.opencmis.client.api.*

String cql = "SELECT cmis:objectId, cmis:name, cmis:contentStreamLength FROM cmis:document"

//ItemIterable<QueryResult> results = session.query(cql, false)

//ItemIterable<QueryResult> results = session.query(cql, false).getPage(10)
ItemIterable<QueryResult> results = session.query(cql, false).skipTo(10).getPage(10)

results.each { hit -> 
    hit.properties.each { println "${it.queryName}: ${it.firstValue}" }
    println "————————————–"
}

println "————————————–"   
println "Total number: ${results.totalNumItems}"
println "Has more: ${results.hasMoreItems}"
println "————————————–"

And this is the error shown in the output window:

Exception thrown
org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException: Runtime error. Message: org.json.JSONException: Expected a ',' or ']' at character 105230

   at org.apache.chemistry.opencmis.client.bindings.spi.webservices.AbstractWebServicesService.convertException(AbstractWebServicesService.java:115)
   at org.apache.chemistry.opencmis.client.bindings.spi.webservices.DiscoveryServiceImpl.query(DiscoveryServiceImpl.java:87)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl$3.fetchPage(SessionImpl.java:557)
   at org.apache.chemistry.opencmis.client.runtime.util.AbstractIterator.getCurrentPage(AbstractIterator.java:132)
   at org.apache.chemistry.opencmis.client.runtime.util.CollectionPageIterator.hasNext(CollectionPageIterator.java:48)
   at ConsoleScript1.run(ConsoleScript1:13)

The error happens with every query I tried. Queries work fine as long as skipCount remains at 0. I am using a standard install of Alfresco 4.0d Community. Has anyone an idea?

thanks
Karsten

Outcomes