Program: 6
Project: 6
Buggy source:
/** 
 * Search documents in the storing system. <p> Search documents by passing HQL where clause values as parameters. This allows generating a Named HQL query which will automatically encode the passed values (like escaping single quotes). This API is recommended to be used over the other similar methods where the values are passed inside the where clause and for which you'll need to do the encoding/escpaing yourself before calling them.
 * @param wheresql the HQL where clause. For example <code>" where doc.fullName<> ? and (doc.parent = ? or (doc.parent = ? and doc.space = ?))"</code>.
 * @param distinctbylanguage when a document has multiple version for each language it is returned as one document alanguage.
 * @param customMapping inject custom mapping in session.
 * @param checkRight if true check for each found document if context's user has "view" rights for it.
 * @param nb the number of rows to return. If 0 then all rows are returned.
 * @param start the number of rows to skip. If 0 don't skip any row.
 * @param parameterValues the where clause values that replace the question marks (?).
 * @param context the XWiki context required for getting information about the execution context.
 * @return a list of XWikiDocument.
 * @throws XWikiException in case of error while performing the query.
 * @since XWiki Core 1.1.2, XWiki Core 1.2M2
 */
List<XWikiDocument> searchDocuments(String wheresql,boolean distinctbylanguage,boolean customMapping,boolean checkRight,int nb,int start,List<?> parameterValues,XWikiContext context) throws XWikiException ;

Fixed version (ground truth):
/** 
 * Search documents in the storing system. <p> Search documents by passing HQL where clause values as parameters. This allows generating a Named HQL query which will automatically encode the passed values (like escaping single quotes). This API is recommended to be used over the other similar methods where the values are passed inside the where clause and for which you'll need to do the encoding/escpaing yourself before calling them.
 * @param wheresql the HQL where clause. For example: {@code where doc.fullName<> ? and (doc.parent = ? or (doc.parent = ? and doc.space = ?))}
 * @param distinctbylanguage when a document has multiple version for each language it is returned as one document alanguage.
 * @param customMapping inject custom mapping in session.
 * @param checkRight if true check for each found document if context's user has "view" rights for it.
 * @param nb the number of rows to return. If 0 then all rows are returned.
 * @param start the number of rows to skip. If 0 don't skip any row.
 * @param parameterValues the where clause values that replace the question marks (?).
 * @param context the XWiki context required for getting information about the execution context.
 * @return a list of XWikiDocument.
 * @throws XWikiException in case of error while performing the query.
 * @since XWiki Core 1.1.2, XWiki Core 1.2M2
 */
List<XWikiDocument> searchDocuments(String wheresql,boolean distinctbylanguage,boolean customMapping,boolean checkRight,int nb,int start,List<?> parameterValues,XWikiContext context) throws XWikiException ;