Program: 3330
Project: 3330
Buggy source:
/** 
 * Sends an email to the given e-person with details of new items in the given collections, items that appeared yesterday. No e-mail is sent if there aren't any new items in any of the collections.
 * @param context DSpace context object
 * @param eperson eperson to send to
 * @param collections List of collection IDs (Integers)
 * @param test 
 */
public static void sendEmail(Context context,EPerson eperson,List collections,boolean test) throws IOException, MessagingException, SQLException {
  Locale supportedLocale=I18nUtil.getEPersonLocale(eperson);
  ResourceBundle labels=ResourceBundle.getBundle("String_Node_Str",supportedLocale);
  Date thisTimeYesterday=new Date(System.currentTimeMillis() - (24 * 60 * 60* 1000));
  DCDate dcDateYesterday=new DCDate(thisTimeYesterday);
  String isoDateYesterday=dcDateYesterday.toString().substring(0,10);
  String startDate=isoDateYesterday;
  String endDate=isoDateYesterday + "String_Node_Str";
  StringBuffer emailText=new StringBuffer();
  boolean isFirst=true;
  for (int i=0; i < collections.size(); i++) {
    Collection c=(Collection)collections.get(i);
    try {
      List itemInfos=Harvest.harvest(context,c,startDate,endDate,0,0,true,false,false);
      if (ConfigurationManager.getBooleanProperty("String_Node_Str",false)) {
        itemInfos=filterOutModified(itemInfos);
      }
      if (itemInfos.size() > 0) {
        if (!isFirst) {
          emailText.append("String_Node_Str");
        }
 else {
          isFirst=false;
        }
        emailText.append(labels.getString("String_Node_Str")).append(c.getMetadata("String_Node_Str")).append("String_Node_Str").append(itemInfos.size()).append("String_Node_Str");
        for (int j=0; j < itemInfos.size(); j++) {
          HarvestedItemInfo hii=(HarvestedItemInfo)itemInfos.get(j);
          DCValue[] titles=hii.item.getDC("String_Node_Str",null,Item.ANY);
          emailText.append("String_Node_Str").append(labels.getString("String_Node_Str")).append("String_Node_Str");
          if (titles.length > 0) {
            emailText.append(titles[0].value);
          }
 else {
            emailText.append(labels.getString("String_Node_Str"));
          }
          DCValue[] authors=hii.item.getDC("String_Node_Str",Item.ANY,Item.ANY);
          if (authors.length > 0) {
            emailText.append("String_Node_Str").append(labels.getString("String_Node_Str")).append(authors[0].value);
            for (int k=1; k < authors.length; k++) {
              emailText.append("String_Node_Str").append(authors[k].value);
            }
          }
          emailText.append("String_Node_Str").append(labels.getString("String_Node_Str")).append(HandleManager.getCanonicalForm(hii.handle)).append("String_Node_Str");
        }
      }
    }
 catch (    ParseException pe) {
    }
  }
  if (emailText.length() > 0) {
    if (test) {
      log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + eperson.getEmail()));
      log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + emailText.toString()));
    }
 else {
      Email email=ConfigurationManager.getEmail(I18nUtil.getEmailFilename(supportedLocale,"String_Node_Str"));
      email.addRecipient(eperson.getEmail());
      email.addArgument(emailText.toString());
      email.send();
      log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + eperson.getID()));
    }
  }
}

Fixed version (ground truth):
/** 
 * Sends an email to the given e-person with details of new items in the given collections, items that appeared yesterday. No e-mail is sent if there aren't any new items in any of the collections.
 * @param context DSpace context object
 * @param eperson eperson to send to
 * @param collections List of collection IDs (Integers)
 * @param test 
 */
public static void sendEmail(Context context,EPerson eperson,List collections,boolean test) throws IOException, MessagingException, SQLException {
  Locale supportedLocale=I18nUtil.getEPersonLocale(eperson);
  ResourceBundle labels=ResourceBundle.getBundle("String_Node_Str",supportedLocale);
  Date thisTimeYesterday=new Date(System.currentTimeMillis() - (24 * 60 * 60* 1000));
  DCDate dcDateYesterday=new DCDate(thisTimeYesterday);
  String isoDateYesterday=dcDateYesterday.toString().substring(0,10);
  String startDate=isoDateYesterday;
  String endDate=isoDateYesterday + "String_Node_Str";
  StringBuffer emailText=new StringBuffer();
  boolean isFirst=true;
  for (int i=0; i < collections.size(); i++) {
    Collection c=(Collection)collections.get(i);
    try {
      boolean includeAll=ConfigurationManager.getBooleanProperty("String_Node_Str",true);
      List itemInfos=Harvest.harvest(context,c,startDate,endDate,0,0,true,false,false,includeAll);
      if (ConfigurationManager.getBooleanProperty("String_Node_Str",false)) {
        itemInfos=filterOutModified(itemInfos);
      }
      if (itemInfos.size() > 0) {
        if (!isFirst) {
          emailText.append("String_Node_Str");
        }
 else {
          isFirst=false;
        }
        emailText.append(labels.getString("String_Node_Str")).append(c.getMetadata("String_Node_Str")).append("String_Node_Str").append(itemInfos.size()).append("String_Node_Str");
        for (int j=0; j < itemInfos.size(); j++) {
          HarvestedItemInfo hii=(HarvestedItemInfo)itemInfos.get(j);
          DCValue[] titles=hii.item.getDC("String_Node_Str",null,Item.ANY);
          emailText.append("String_Node_Str").append(labels.getString("String_Node_Str")).append("String_Node_Str");
          if (titles.length > 0) {
            emailText.append(titles[0].value);
          }
 else {
            emailText.append(labels.getString("String_Node_Str"));
          }
          DCValue[] authors=hii.item.getDC("String_Node_Str",Item.ANY,Item.ANY);
          if (authors.length > 0) {
            emailText.append("String_Node_Str").append(labels.getString("String_Node_Str")).append(authors[0].value);
            for (int k=1; k < authors.length; k++) {
              emailText.append("String_Node_Str").append(authors[k].value);
            }
          }
          emailText.append("String_Node_Str").append(labels.getString("String_Node_Str")).append(HandleManager.getCanonicalForm(hii.handle)).append("String_Node_Str");
        }
      }
    }
 catch (    ParseException pe) {
    }
  }
  if (emailText.length() > 0) {
    if (test) {
      log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + eperson.getEmail()));
      log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + emailText.toString()));
    }
 else {
      Email email=ConfigurationManager.getEmail(I18nUtil.getEmailFilename(supportedLocale,"String_Node_Str"));
      email.addRecipient(eperson.getEmail());
      email.addArgument(emailText.toString());
      email.send();
      log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + eperson.getID()));
    }
  }
}