Program: 73689
Project: 73689
Buggy source:
/** 
 * Perform the actual pattern match for the passed models. 
 * @exception DBConnectionException Thrown from the database layer if the connection to database cannot be obtained. 
 * @exception DBExecutionException Thrown from the database layer if erroroccurs during some execution. 
 */
@Override protected void _search() throws DBConnectionException, DBExecutionException {
  Pattern pattern=_dbGraphSearchCriteria.getPattern();
  GraphMatcher matcher=new GraphMatcher();
  _parser=new MoMLParser();
  int count=0;
  ArrayList<XMLDBModel> modelsBatch=new ArrayList<XMLDBModel>();
  int fetchedCount=0;
  for (  XMLDBModel model : _previousResults) {
    modelsBatch.add(model);
    count++;
    fetchedCount++;
    if (count == 5 || fetchedCount == _previousResults.size()) {
      count=0;
      List<XMLDBModel> fullModels=DBModelFetcher.load(modelsBatch);
      for (      XMLDBModel fullModel : fullModels) {
        if (isSearchCancelled()) {
          return;
        }
        CompositeEntity modelNamedObj;
        try {
          modelNamedObj=(CompositeEntity)_parser.parse(fullModel.getModel());
        }
 catch (        Exception e) {
          _addErrorModel(fullModel);
          continue;
        }
        MatchResultRecorder recorder=new MatchResultRecorder();
        matcher.setMatchCallback(recorder);
        matcher.match(pattern,modelNamedObj);
        List<MatchResult> matchResults=recorder.getResults();
        if (!matchResults.isEmpty()) {
          ArrayList<XMLDBModel> tempResultsList=new ArrayList<XMLDBModel>();
          tempResultsList.add(fullModel);
          _nextResultHandler.handleResults(tempResultsList);
        }
      }
      modelsBatch=new ArrayList<XMLDBModel>();
    }
  }
  passErrorModels(_errorModels);
  wholeSearchDone();
}

Fixed version (ground truth):
/** 
 * Perform the actual pattern match for the passed models. 
 * @exception DBConnectionException Thrown from the database layer if the connection to database cannot be obtained. 
 * @exception DBExecutionException Thrown from the database layer if erroroccurs during some execution. 
 */
@Override protected void _search() throws DBConnectionException, DBExecutionException {
  Pattern pattern=_dbGraphSearchCriteria.getPattern();
  _parser=new MoMLParser();
  GraphMatcher matcher=new GraphMatcher();
  int count=0;
  ArrayList<XMLDBModel> modelsBatch=new ArrayList<XMLDBModel>();
  int fetchedCount=0;
  for (  XMLDBModel model : _previousResults) {
    modelsBatch.add(model);
    count++;
    fetchedCount++;
    if (count == 5 || fetchedCount == _previousResults.size()) {
      count=0;
      List<XMLDBModel> fullModels=DBModelFetcher.load(modelsBatch);
      for (      XMLDBModel fullModel : fullModels) {
        if (isSearchCancelled()) {
          return;
        }
        CompositeEntity modelNamedObj;
        try {
          _parser.resetAll();
          modelNamedObj=(CompositeEntity)_parser.parse(fullModel.getModel());
        }
 catch (        Exception e) {
          _addErrorModel(fullModel);
          continue;
        }
        MatchResultRecorder recorder=new MatchResultRecorder();
        matcher.setMatchCallback(recorder);
        matcher.match(pattern,modelNamedObj);
        List<MatchResult> matchResults=recorder.getResults();
        if (!matchResults.isEmpty()) {
          ArrayList<XMLDBModel> tempResultsList=new ArrayList<XMLDBModel>();
          tempResultsList.add(fullModel);
          _nextResultHandler.handleResults(tempResultsList);
        }
      }
      modelsBatch=new ArrayList<XMLDBModel>();
    }
  }
  passErrorModels(_errorModels);
  wholeSearchDone();
}