Program: 189377
Project: 189377
Buggy source:
@Security(RoleType.MANAGER) public static void addEditEmailWorkflowRuleJSON(String id,String stateString,String conditionCategory,String conditionIDString,String recipientString,String templateString){
  try {
    if (stateString == null || stateString.trim().length() == 0)     throw new IllegalArgumentException("String_Node_Str");
    if (conditionCategory == null || conditionCategory.trim().length() == 0)     conditionCategory="String_Node_Str";
    JpaEmailWorkflowRuleConditionImpl condition;
    if (conditionCategory == null || conditionCategory.trim().length() == 0) {
      condition=null;
    }
 else {
      condition=new JpaEmailWorkflowRuleConditionImpl();
      condition.setConditionId(Long.parseLong(conditionIDString));
      condition.setConditionType(ConditionType.valueOf(conditionCategory));
    }
    EmailTemplate template;
    if (templateString == null || templateString.trim().length() == 0) {
      template=null;
    }
 else {
      template=settingRepo.findEmailTemplateByName(templateString);
    }
    State associatedState=stateManager.getState(stateString);
    List<WorkflowEmailRule> rules=settingRepo.findWorkflowEmailRulesByState(associatedState);
    WorkflowEmailRule rule;
    if (id != null && id.trim().length() > 0 && id != (null)) {
      Long ruleID=Long.valueOf(id);
      rule=settingRepo.findWorkflowEmailRule(ruleID);
      rule.setCondition(condition);
      rule.setRecipientType(RecipientType.valueOf(recipientString));
      rule.setEmailTemplate(template);
    }
 else {
      rule=settingRepo.createWorkflowEmailRule(associatedState,conditionCategory,condition,RecipientType.valueOf(recipientString),template);
    }
    rules.add(rule);
    saveModelOrder(rules);
    Logger.info("String_Node_Str");
    String stateJSON=rule.getAssociatedState().getBeanName();
    renderJSON("String_Node_Str" + rule.getId() + "String_Node_Str"+ stateJSON+ "String_Node_Str"+ conditionCategory+ "String_Node_Str"+ rule.getCondition()+ "String_Node_Str"+ rule.getRecipientType().name()+ "String_Node_Str"+ rule.getEmailTemplate()+ "String_Node_Str");
  }
 catch (  RuntimeException re) {
    Logger.error(re,"String_Node_Str");
    String message=escapeJavaScript(re.getMessage());
    renderJSON("String_Node_Str" + message + "String_Node_Str");
  }
}

Fixed version (ground truth):
@Security(RoleType.MANAGER) public static void addEditEmailWorkflowRuleJSON(String id,String stateString,String conditionCategory,String conditionIDString,String recipientString,String templateString){
  try {
    if (stateString == null || stateString.trim().length() == 0)     throw new IllegalArgumentException("String_Node_Str");
    State associatedState=stateManager.getState(stateString);
    if (conditionCategory == null || conditionCategory.trim().length() == 0)     conditionCategory="String_Node_Str";
    JpaEmailWorkflowRuleConditionImpl condition;
    if (conditionCategory == null || conditionCategory.trim().length() == 0) {
      condition=null;
    }
 else {
      condition=new JpaEmailWorkflowRuleConditionImpl();
      condition.setConditionId(Long.parseLong(conditionIDString));
      condition.setConditionType(ConditionType.valueOf(conditionCategory));
    }
    EmailTemplate template;
    if (templateString == null || templateString.trim().length() == 0) {
      template=null;
    }
 else {
      template=settingRepo.findEmailTemplateByName(templateString);
    }
    RecipientType recipient=null;
    if ((recipientString != null) || (templateString.trim().length() == 0) || (templateString != "String_Node_Str")) {
      recipient=RecipientType.valueOf(recipientString);
    }
    List<WorkflowEmailRule> rules=settingRepo.findWorkflowEmailRulesByState(associatedState);
    WorkflowEmailRule rule;
    if (false) {
      Logger.info(id);
      Long ruleID=Long.parseLong(id);
      rule=settingRepo.findWorkflowEmailRule(ruleID);
      rule.setCondition(condition);
      rule.setRecipientType(RecipientType.valueOf(recipientString));
      rule.setEmailTemplate(template);
    }
 else {
      rule=settingRepo.createWorkflowEmailRule(associatedState,conditionCategory,condition,recipient,template);
    }
    rules.add(rule);
    Logger.info("String_Node_Str");
    String stateJSON=rule.getAssociatedState().getBeanName();
    renderJSON("String_Node_Str" + rule.getId() + "String_Node_Str"+ stateJSON+ "String_Node_Str"+ rule.getCondition().getConditionType()+ "String_Node_Str"+ rule.getCondition().getConditionId()+ "String_Node_Str"+ rule.getRecipientType().name()+ "String_Node_Str"+ rule.getEmailTemplate()+ "String_Node_Str");
  }
 catch (  RuntimeException re) {
    Logger.error(re,"String_Node_Str");
    String message=escapeJavaScript(re.getMessage());
    renderJSON("String_Node_Str" + message + "String_Node_Str");
  }
}