Program: 189374
Project: 189374
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");
    State associatedState=stateManager.getState(stateString);
    List<WorkflowEmailRule> rules=settingRepo.findWorkflowEmailRulesByState(associatedState);
    WorkflowEmailRule rule;
    String conditionCatagoryJSON="String_Node_Str";
    String conditionIdJSON="String_Node_Str";
    String recipientTypeJSON="String_Node_Str";
    String templateJSON="String_Node_Str";
    if ((id != null) && (id.trim().length() != 0) && (!id.equals("String_Node_Str"))) {
      Long ruleID=Long.parseLong(id);
      rule=settingRepo.findWorkflowEmailRule(ruleID);
      AbstractWorkflowRuleCondition condition;
      if ((condition=rule.getCondition()) != null) {
        condition=new JpaEmailWorkflowRuleConditionImpl();
      }
      if (conditionCategory != null && conditionCategory.trim().length() != 0) {
        condition.setConditionType(ConditionType.valueOf(conditionCategory));
        rule.setCondition(condition);
        conditionCatagoryJSON=rule.getCondition().getConditionType().name();
      }
      if (conditionIDString != null && conditionIDString.trim().length() != 0) {
        condition.setConditionId(Long.parseLong(conditionIDString));
        rule.setCondition(condition);
        conditionIdJSON=rule.getCondition().getConditionId().toString();
      }
      EmailTemplate template;
      if (templateString != null && templateString.trim().length() != 0) {
        template=settingRepo.findEmailTemplateByName(templateString);
        rule.setEmailTemplate(template);
      }
      if (recipientString != null && recipientString.trim().length() != 0) {
        rule.setRecipientType(RecipientType.valueOf(recipientString));
        recipientTypeJSON=rule.getRecipientType().name();
        templateJSON=rule.getEmailTemplate().getName();
      }
    }
 else {
      rule=settingRepo.createWorkflowEmailRule(associatedState);
    }
    rules.add(rule);
    saveModelOrder(rules);
    Logger.info("String_Node_Str");
    renderJSON("String_Node_Str" + rule.getId() + "String_Node_Str"+ rule.getAssociatedState().getBeanName()+ "String_Node_Str"+ conditionCatagoryJSON+ "String_Node_Str"+ conditionIdJSON+ "String_Node_Str"+ recipientTypeJSON+ "String_Node_Str"+ templateJSON+ "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);
    List<WorkflowEmailRule> rules=settingRepo.findWorkflowEmailRulesByState(associatedState);
    WorkflowEmailRule rule;
    String conditionCatagoryJSON="String_Node_Str";
    String conditionIdJSON="String_Node_Str";
    String recipientTypeJSON="String_Node_Str";
    String templateJSON="String_Node_Str";
    if ((id != null) && (id.trim().length() != 0) && (!id.equals("String_Node_Str"))) {
      Long ruleID=Long.parseLong(id);
      rule=settingRepo.findWorkflowEmailRule(ruleID);
      AbstractWorkflowRuleCondition condition;
      if ((condition=rule.getCondition()) == null) {
        condition=new JpaEmailWorkflowRuleConditionImpl();
        condition.save();
        rule.setCondition(condition);
      }
      if (conditionCategory != null && conditionCategory.trim().length() != 0) {
        condition.setConditionType(ConditionType.valueOf(conditionCategory));
        conditionCatagoryJSON=rule.getCondition().getConditionType().name();
        condition.save();
      }
      if (conditionIDString != null && conditionIDString.trim().length() != 0) {
        condition.setConditionId(Long.parseLong(conditionIDString));
        conditionIdJSON=rule.getCondition().getConditionId().toString();
        condition.save();
      }
      EmailTemplate template;
      if (templateString != null && templateString.trim().length() != 0) {
        template=settingRepo.findEmailTemplateByName(templateString);
        rule.setEmailTemplate(template);
      }
      if (recipientString != null && recipientString.trim().length() != 0) {
        rule.setRecipientType(RecipientType.valueOf(recipientString));
        recipientTypeJSON=rule.getRecipientType().name();
        templateJSON=rule.getEmailTemplate().getName();
      }
    }
 else {
      rule=settingRepo.createWorkflowEmailRule(associatedState);
    }
    rules.add(rule);
    saveModelOrder(rules);
    Logger.info("String_Node_Str");
    renderJSON("String_Node_Str" + rule.getId() + "String_Node_Str"+ rule.getAssociatedState().getBeanName()+ "String_Node_Str"+ conditionCatagoryJSON+ "String_Node_Str"+ conditionIdJSON+ "String_Node_Str"+ recipientTypeJSON+ "String_Node_Str"+ templateJSON+ "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");
  }
}