Program: 3333
Project: 3333
Buggy source:
/** 
 * Method to do the actual harvest of records
 * @param from OAI 'from' parameter
 * @param until OAI 'until' parameter
 * @param set OAI 'set' parameter
 * @param metadataPrefix OAI 'metadataPrefix' parameter
 * @param offset where to start this harvest
 * @return the Map for listRecords to return, or null if the metadataPrefixis invalid
 */
private Map doRecordHarvest(String from,String until,String set,String metadataPrefix,int offset) throws OAIInternalServerError, BadArgumentException {
  Context context=null;
  String schemaURL=getCrosswalks().getSchemaURL(metadataPrefix);
  Map results=new HashMap();
  if (schemaURL == null) {
    return null;
  }
  List records=new LinkedList();
  try {
    context=new Context();
    DSpaceObject scope=resolveSet(context,set);
    List itemInfos=Harvest.harvest(context,scope,from,until,offset,MAX_RECORDS,true,true,true);
    Iterator i=itemInfos.iterator();
    while (i.hasNext()) {
      HarvestedItemInfo itemInfo=(HarvestedItemInfo)i.next();
      try {
        String recordXML=getRecordFactory().create(itemInfo,schemaURL,metadataPrefix);
        records.add(recordXML);
      }
 catch (      CannotDisseminateFormatException cdfe) {
        if (log.isDebugEnabled()) {
          log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + metadataPrefix + "String_Node_Str"+ itemInfo.handle));
        }
      }
    }
    results.put("String_Node_Str",records.iterator());
    log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + records.size()));
    if (records.size() >= MAX_RECORDS) {
      String resumptionToken=makeResumptionToken(from,until,set,metadataPrefix,offset + MAX_RECORDS);
      if (log.isDebugEnabled()) {
        log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + resumptionToken));
      }
      results.put("String_Node_Str",getResumptionMap(resumptionToken));
    }
  }
 catch (  SQLException se) {
    log.warn(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"),se);
    throw new OAIInternalServerError(se.toString());
  }
catch (  ParseException pe) {
    throw new OAIInternalServerError(pe.toString());
  }
 finally {
    if (context != null) {
      context.abort();
    }
  }
  return results;
}

Fixed version (ground truth):
/** 
 * Method to do the actual harvest of records
 * @param from OAI 'from' parameter
 * @param until OAI 'until' parameter
 * @param set OAI 'set' parameter
 * @param metadataPrefix OAI 'metadataPrefix' parameter
 * @param offset where to start this harvest
 * @return the Map for listRecords to return, or null if the metadataPrefixis invalid
 */
private Map doRecordHarvest(String from,String until,String set,String metadataPrefix,int offset) throws OAIInternalServerError, BadArgumentException {
  Context context=null;
  String schemaURL=getCrosswalks().getSchemaURL(metadataPrefix);
  Map results=new HashMap();
  if (schemaURL == null) {
    return null;
  }
  List records=new LinkedList();
  try {
    context=new Context();
    DSpaceObject scope=resolveSet(context,set);
    boolean includeAll=ConfigurationManager.getBooleanProperty("String_Node_Str",true);
    List itemInfos=Harvest.harvest(context,scope,from,until,offset,MAX_RECORDS,true,true,true,includeAll);
    Iterator i=itemInfos.iterator();
    while (i.hasNext()) {
      HarvestedItemInfo itemInfo=(HarvestedItemInfo)i.next();
      try {
        String recordXML=getRecordFactory().create(itemInfo,schemaURL,metadataPrefix);
        records.add(recordXML);
      }
 catch (      CannotDisseminateFormatException cdfe) {
        if (log.isDebugEnabled()) {
          log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + metadataPrefix + "String_Node_Str"+ itemInfo.handle));
        }
      }
    }
    results.put("String_Node_Str",records.iterator());
    log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + records.size()));
    if (records.size() >= MAX_RECORDS) {
      String resumptionToken=makeResumptionToken(from,until,set,metadataPrefix,offset + MAX_RECORDS);
      if (log.isDebugEnabled()) {
        log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + resumptionToken));
      }
      results.put("String_Node_Str",getResumptionMap(resumptionToken));
    }
  }
 catch (  SQLException se) {
    log.warn(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"),se);
    throw new OAIInternalServerError(se.toString());
  }
catch (  ParseException pe) {
    throw new OAIInternalServerError(pe.toString());
  }
 finally {
    if (context != null) {
      context.abort();
    }
  }
  return results;
}