Program: 189382
Project: 189382
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){
  String subject=params.get("String_Node_Str");
  String message=params.get("String_Node_Str");
  if (params.get("String_Node_Str") != null) {
    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");
  }
  if (!validation.hasErrors()) {
    if (params.get("String_Node_Str") != null)     submission.setState(stateManager.getState("String_Node_Str"));
    VireoEmail email=emailService.createEmail();
    email.addParameters(submission);
    email.setSubject(subject);
    email.setMessage(message);
    email.applyParameterSubstitution();
    email.addTo(submission.getSubmitter());
    if (params.get("String_Node_Str") != null && submission.getCommitteeContactEmail() != null) {
      email.addCc(submission.getCommitteeContactEmail());
    }
    email.setFrom(context.getPerson());
    email.setReplyTo(context.getPerson());
    if (params.get("String_Node_Str") != null && "String_Node_Str".equals(params.get("String_Node_Str"))) {
      email.setLogOnCompletion(context.getPerson(),submission);
      emailService.sendEmail(email,false);
    }
 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);
      submission.save();
      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){
  String subject=params.get("String_Node_Str");
  String message=params.get("String_Node_Str");
  if (params.get("String_Node_Str") != null) {
    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");
  }
  if (!validation.hasErrors()) {
    if (params.get("String_Node_Str") != null) {
      submission.setState(stateManager.getState("String_Node_Str"));
      submission.save();
    }
    VireoEmail email=emailService.createEmail();
    email.addParameters(submission);
    email.setSubject(subject);
    email.setMessage(message);
    email.applyParameterSubstitution();
    email.addTo(submission.getSubmitter());
    if (params.get("String_Node_Str") != null && submission.getCommitteeContactEmail() != null)     email.addCc(submission.getCommitteeContactEmail());
    email.setFrom(context.getPerson());
    email.setReplyTo(context.getPerson());
    if (params.get("String_Node_Str") != null && "String_Node_Str".equals(params.get("String_Node_Str"))) {
      email.setLogOnCompletion(context.getPerson(),submission);
      emailService.sendEmail(email,false);
    }
 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();
    }
  }
}