Program: 189351
Project: 189351
Buggy source:
/** 
 * A method to add an Action Log Comment and send an email if requested.
 * @param id (The submission id)
 */
@Security(RoleType.REVIEWER) private static void addActionLogComment(Submission submission){
  List<String> primary_recipients=params.get("String_Node_Str") == null ? new ArrayList<String>() : Utilities.processEmailDesigneeArray(params.get("String_Node_Str").split("String_Node_Str"),submission);
  List<String> cc_recipients=params.get("String_Node_Str") == null ? new ArrayList<String>() : Utilities.processEmailDesigneeArray(params.get("String_Node_Str").split("String_Node_Str"),submission);
  String subject=params.get("String_Node_Str");
  String message=params.get("String_Node_Str");
  if (primary_recipients.size() > 0) {
    if (subject == null || subject.isEmpty())     validation.addError("String_Node_Str","String_Node_Str");
    if (message == null || message.isEmpty())     validation.addError("String_Node_Str","String_Node_Str");
    for (    String email_address : primary_recipients) {
      Utilities.validateEmailAddress(email_address,validation);
    }
    for (    String email_address : cc_recipients) {
      Utilities.validateEmailAddress(email_address,validation);
    }
  }
 else {
    validation.addError("String_Node_Str","String_Node_Str");
  }
  if (!validation.hasErrors()) {
    VireoEmail email=emailService.createEmail();
    email.addParameters(submission);
    email.setSubject(subject);
    email.setMessage(message);
    email.applyParameterSubstitution();
    for (    String email_address : primary_recipients) {
      email.addTo(email_address);
    }
    for (    String email_address : cc_recipients) {
      email.addCc(email_address);
    }
    email.setReplyTo(context.getPerson());
    if (primary_recipients.size() > 0 && params.get("String_Node_Str").equals("String_Node_Str")) {
      email.setLogOnCompletion(context.getPerson(),submission);
      emailService.sendEmail(email,true);
    }
 else {
      subject=email.getSubject();
      message=email.getMessage();
      String entry;
      if (subject != null && subject.trim().length() > 0)       entry=subject + "String_Node_Str" + message;
 else       entry=message;
      ActionLog log=submission.logAction(entry);
      if ("String_Node_Str".equals(params.get("String_Node_Str")))       log.setPrivate(true);
      log.save();
    }
  }
}

Fixed version (ground truth):
/** 
 * A method to add an Action Log Comment and send an email if requested.
 * @param id (The submission id)
 */
@Security(RoleType.REVIEWER) private static void addActionLogComment(Submission submission){
  List<String> primary_recipients=params.get("String_Node_Str") == null ? new ArrayList<String>() : Utilities.processEmailDesigneeArray(params.get("String_Node_Str").split("String_Node_Str"),submission);
  List<String> cc_recipients=params.get("String_Node_Str") == null ? new ArrayList<String>() : Utilities.processEmailDesigneeArray(params.get("String_Node_Str").split("String_Node_Str"),submission);
  String subject=params.get("String_Node_Str");
  String message=params.get("String_Node_Str");
  if (subject == null || subject.isEmpty())   validation.addError("String_Node_Str","String_Node_Str");
  if (message == null || message.isEmpty())   validation.addError("String_Node_Str","String_Node_Str");
  for (  String email_address : primary_recipients) {
    Utilities.validateEmailAddress(email_address,validation);
  }
  for (  String email_address : cc_recipients) {
    Utilities.validateEmailAddress(email_address,validation);
  }
  if ((params.get("String_Node_Str") != null && primary_recipients.size() == 0) || (params.get("String_Node_Str") == null && params.get("String_Node_Str") != null)) {
    validation.addError("String_Node_Str","String_Node_Str");
  }
  if (params.get("String_Node_Str") != null && cc_recipients.size() == 0) {
    validation.addError("String_Node_Str","String_Node_Str");
  }
  if (!validation.hasErrors()) {
    VireoEmail email=emailService.createEmail();
    email.addParameters(submission);
    email.setSubject(subject);
    email.setMessage(message);
    email.applyParameterSubstitution();
    for (    String email_address : primary_recipients) {
      email.addTo(email_address);
    }
    for (    String email_address : cc_recipients) {
      email.addCc(email_address);
    }
    email.setReplyTo(context.getPerson());
    if (primary_recipients.size() > 0 && params.get("String_Node_Str").equals("String_Node_Str")) {
      email.setLogOnCompletion(context.getPerson(),submission);
      emailService.sendEmail(email,true);
    }
 else {
      subject=email.getSubject();
      message=email.getMessage();
      String entry;
      if (subject != null && subject.trim().length() > 0)       entry=subject + "String_Node_Str" + message;
 else       entry=message;
      ActionLog log=submission.logAction(entry);
      if ("String_Node_Str".equals(params.get("String_Node_Str")))       log.setPrivate(true);
      log.save();
    }
  }
}