AnsweredAssumed Answered

Strange behavior with cmis session query

Question asked by udayakumar_p on Jul 10, 2019

Below is a sample code we use in our app.

 

ItemIterable<QueryResult> results = this.getSession().query(query, false);

 

for (QueryResult qResult : results) {
            //some stuff
        }

Here is a sample query.

 

Select * from common:basedoc where CONTAINS('PATH:"//app:company_home/st:sites/cm:digitalcontent/cm:documentLibrary/cm:TESTFOLDER//*"')  AND  (  (  (  common:contentStatus  = 'READY' )  )  )

 

The document/content in the alfresco has a custom property named 'contentStatus' so the above query is basically to retrieve all those contents that are READY status.

 

We started facing a strange issue. The issue is that even though there is no content  that are with READY status the query returns 7 results that are null. So in the above code, the enhanced for loop keeps running indefinitely iterating null objects. Even if i place an if condition to check for null value the for loop runs indefinitely.

 

When i run the same query in CMIS workbench it is not returning any result but the java code using CMIS SessionImpl is returning 7 null objects. Kindly help.

Outcomes