Program: 168467
Project: 168467
Buggy source:
/** 
 * Execute an usual query.
 * @param mongoClient the MongoDB client.
 * @return the Crossdata ResultSet.
 * @throws MongoValidationException if the query specified in the logical workflow is not supported.
 * @throws ExecutionException if the execution fails.
 */
public ResultSet executeQuery(MongoClient mongoClient) throws ExecutionException, MongoValidationException {
  DB db=mongoClient.getDB(logicalWorkflowData.getProject().getCatalogName());
  DBCollection collection=db.getCollection(logicalWorkflowData.getProject().getTableName().getName());
  ResultSet resultSet=new ResultSet();
  resultSet.setColumnMetadata(MetaResultUtils.createMetadata(logicalWorkflowData.getProject(),logicalWorkflowData.getSelect()));
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + query.get(0) + "String_Node_Str"+ buildProject(false));
  }
  DBCursor cursor=collection.find(query.get(0),buildProject(false));
  if (logicalWorkflowData.getOrderBy() != null) {
    cursor=cursor.sort(buildOrderBy(false));
  }
  if (logicalWorkflowData.getLimit() != null) {
    cursor=cursor.limit(logicalWorkflowData.getLimit().getLimit());
  }
  DBObject rowDBObject;
  try {
    while (cursor.hasNext()) {
      rowDBObject=cursor.next();
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + rowDBObject);
      }
      resultSet.add(MetaResultUtils.createRowWithAlias(rowDBObject,logicalWorkflowData.getSelect()));
    }
  }
 catch (  MongoException e) {
    logger.error("String_Node_Str" + query.get(0) + "String_Node_Str"+ buildProject(false)+ "String_Node_Str"+ e.getMessage());
    throw new MongoExecutionException(e.getMessage(),e);
  }
 finally {
    cursor.close();
  }
  return resultSet;
}

Fixed version (ground truth):
/** 
 * Execute an usual query.
 * @param mongoClient the MongoDB client.
 * @return the Crossdata ResultSet.
 * @throws MongoValidationException .
 * @throws ExecutionException if the execution fails or the query specified in the logical workflow is not supported.
 */
public ResultSet executeQuery(MongoClient mongoClient) throws ExecutionException {
  DB db=mongoClient.getDB(logicalWorkflowData.getProject().getCatalogName());
  DBCollection collection=db.getCollection(logicalWorkflowData.getProject().getTableName().getName());
  ResultSet resultSet=new ResultSet();
  resultSet.setColumnMetadata(MetaResultUtils.createMetadata(logicalWorkflowData.getProject(),logicalWorkflowData.getSelect()));
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + query.get(0) + "String_Node_Str"+ buildProject(false));
  }
  DBCursor cursor=collection.find(query.get(0),buildProject(false));
  if (logicalWorkflowData.getOrderBy() != null) {
    cursor=cursor.sort(buildOrderBy(false));
  }
  if (logicalWorkflowData.getLimit() != null) {
    cursor=cursor.limit(logicalWorkflowData.getLimit().getLimit());
  }
  DBObject rowDBObject;
  try {
    while (cursor.hasNext()) {
      rowDBObject=cursor.next();
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + rowDBObject);
      }
      resultSet.add(MetaResultUtils.createRowWithAlias(rowDBObject,logicalWorkflowData.getSelect()));
    }
  }
 catch (  MongoException e) {
    logger.error("String_Node_Str" + query.get(0) + "String_Node_Str"+ buildProject(false)+ "String_Node_Str"+ e.getMessage());
    throw new MongoExecutionException(e.getMessage(),e);
  }
 finally {
    cursor.close();
  }
  return resultSet;
}