AnsweredAssumed Answered

Query with skipCount

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

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.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 -> { 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(
   at org.apache.chemistry.opencmis.client.bindings.spi.webservices.DiscoveryServiceImpl.query(
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl$3.fetchPage(
   at org.apache.chemistry.opencmis.client.runtime.util.AbstractIterator.getCurrentPage(
   at org.apache.chemistry.opencmis.client.runtime.util.CollectionPageIterator.hasNext(

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?