Program: 169103
Project: 169103
Buggy source:
/** 
 * This method execute a query in elasticSearch.
 * @param elasticClient  the elasticSearch Client.
 * @param requestBuilder the query to execute.
 * @param queryData      the queryData.
 * @return the query result.
 */
public QueryResult executeQuery(Client elasticClient,SearchRequestBuilder requestBuilder,ConnectorQueryData queryData) throws ExecutionException {
  QueryResult queryResult=null;
  try {
    ResultSet resultSet=new ResultSet();
    SearchResponse scrollResp=requestBuilder.execute().actionGet();
    long countResult=0;
    boolean isLimit=false;
    long limit=0;
    boolean endQuery=false;
    if (queryData.getLimit() != null) {
      isLimit=true;
      limit=queryData.getLimit().getLimit();
    }
    MetadataCreator crossdatadataCreator=new MetadataCreator();
    resultSet.setColumnMetadata(crossdatadataCreator.createColumnMetadata(queryData));
    do {
      scrollResp=elasticClient.prepareSearchScroll(scrollResp.getScrollId()).setScroll(new TimeValue(SCAN_TIMEOUT_MILLIS)).execute().actionGet();
      for (      SearchHit hit : scrollResp.getHits()) {
        if (isLimit && countResult == limit) {
          endQuery=true;
          break;
        }
        countResult++;
        resultSet.add(createRow(hit,queryData));
      }
    }
 while (scrollResp.getHits().getHits().length != 0 && !endQuery);
    queryResult=QueryResult.createQueryResult(resultSet);
  }
 catch (  IndexMissingException e) {
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str" + e.getMessage());
    }
    queryResult=QueryResult.createQueryResult(new ResultSet());
  }
  return queryResult;
}

Fixed version (ground truth):
/** 
 * This method execute a query in elasticSearch.
 * @param elasticClient the elasticSearch Client.
 * @param requestBuilder the query to execute.
 * @param queryData the queryData.
 * @return the query result.
 */
public QueryResult executeQuery(Client elasticClient,SearchRequestBuilder requestBuilder,ConnectorQueryData queryData) throws ExecutionException {
  QueryResult queryResult=null;
  try {
    ResultSet resultSet=new ResultSet();
    SearchResponse scrollResp=requestBuilder.execute().actionGet();
    long countResult=0;
    boolean isLimit=false;
    long limit=0;
    boolean endQuery=false;
    if (queryData.getLimit() != null) {
      isLimit=true;
      limit=queryData.getLimit().getLimit();
    }
    MetadataCreator crossdatadataCreator=new MetadataCreator();
    resultSet.setColumnMetadata(crossdatadataCreator.createColumnMetadata(queryData));
    do {
      scrollResp=elasticClient.prepareSearchScroll(scrollResp.getScrollId()).setScroll(new TimeValue(SCAN_TIMEOUT_MILLIS)).execute().actionGet();
      for (      SearchHit hit : scrollResp.getHits()) {
        if (isLimit && countResult == limit) {
          endQuery=true;
          break;
        }
        countResult++;
        resultSet.add(createRow(hit,queryData));
      }
    }
 while (scrollResp.getHits().getHits().length != 0 && !endQuery);
    queryResult=QueryResult.createQueryResult(resultSet);
  }
 catch (  IndexMissingException e) {
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str" + e.getMessage());
    }
    queryResult=QueryResult.createQueryResult(new ResultSet());
  }
  return queryResult;
}