Program: 73686
Project: 73686
Buggy source:
/** 
 * Handle the model results passed to this class, and handle the results according to the certain search criteria. The  search criteria is passed to the concrete searchers when they are  constructed. 
 * @param modelResults The results to be handled in this searcher.
 * @exception DBConnectionException Thrown by the DBConnectorFactoryif getting the DBConnection from it, which indicates that the DBConnection cannot be obtained.
 * @exception DBExecutionException Happens in the executionof DB tasks, and is thrown by the concrete searcher if they are performing the actual searching in the database.
 */
public void handleResults(ArrayList<XMLDBModel> modelResults) throws DBConnectionException, DBExecutionException {
  if (isSearchCancelled()) {
    return;
  }
  _previousResults=modelResults;
  if (_noMatch()) {
    wholeSearchDone();
  }
 else {
    if (_isSearchCriteriaSet()) {
      if (this instanceof AbstractDBSearcher) {
        try {
          if (_dbConnection == null) {
            _dbConnection=DBConnectorFactory.getSyncConnection(false);
            setConnection(_dbConnection);
          }
          _search();
        }
 catch (        DBExecutionException e) {
          _dbConnection.closeConnection();
          throw e;
        }
        if ((!_isFirstSearcher()) && _isIntersectNeeded()) {
          if (_isSearchCriteriaSet()) {
            _toPassResults=Utilities.intersectResults(_previousResults,_currentResults);
          }
 else {
            _toPassResults=_previousResults;
          }
        }
 else {
          _toPassResults=_currentResults;
        }
        _nextResultHandler.handleResults(_toPassResults);
      }
 else {
        _search();
      }
    }
 else {
      _pass();
      _nextResultHandler.handleResults(modelResults);
    }
    if (_isLastSeacher() && _previousSearcher.isPassed()) {
      _nextResultHandler.wholeSearchDone();
    }
  }
}

Fixed version (ground truth):
/** 
 * Handle the model results passed to this class, and handle the results according to the certain search criteria. The  search criteria is passed to the concrete searchers when they are  constructed. 
 * @param modelResults The results to be handled in this searcher.
 * @exception DBConnectionException Thrown by the DBConnectorFactoryif getting the DBConnection from it, which indicates that the DBConnection cannot be obtained.
 * @exception DBExecutionException Happens in the executionof DB tasks, and is thrown by the concrete searcher if they are performing the actual searching in the database.
 */
public void handleResults(ArrayList<XMLDBModel> modelResults) throws DBConnectionException, DBExecutionException {
  if (isSearchCancelled()) {
    return;
  }
  _previousResults=modelResults;
  if (_previousResults != null && _previousResults.size() > 0) {
    Collections.sort(_previousResults);
  }
  if (_noMatch()) {
    wholeSearchDone();
  }
 else {
    if (_isSearchCriteriaSet()) {
      if (this instanceof AbstractDBSearcher) {
        try {
          if (_dbConnection == null) {
            _dbConnection=DBConnectorFactory.getSyncConnection(false);
            setConnection(_dbConnection);
          }
          _search();
        }
 catch (        DBExecutionException e) {
          _dbConnection.closeConnection();
          throw e;
        }
        if ((!_isFirstSearcher()) && _isIntersectNeeded()) {
          if (_isSearchCriteriaSet()) {
            _toPassResults=Utilities.intersectResults(_previousResults,_currentResults);
          }
 else {
            _toPassResults=_previousResults;
          }
        }
 else {
          _toPassResults=_currentResults;
        }
        _nextResultHandler.handleResults(_toPassResults);
      }
 else {
        _search();
      }
    }
 else {
      _pass();
      _nextResultHandler.handleResults(modelResults);
    }
    if (_isLastSeacher() && _previousSearcher.isPassed()) {
      _nextResultHandler.wholeSearchDone();
    }
  }
}