Program: 189373
Project: 189373
Buggy source:
@Security(RoleType.MANAGER) public static void addEditEmailWorkflowRuleJSON(String id,String stateString,String conditionCategory,String conditionIDString,String recipientString,String templateString){
  try {
    Logger.info(recipientString);
    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 conditionCategoryJSON="String_Node_Str";
    String conditionIdJSON="String_Node_Str";
    String conditionDisplayJSON="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));
        condition.setConditionId(null);
        conditionCategoryJSON=rule.getCondition().getConditionType().name();
        condition.save();
      }
      if (conditionIDString != null && conditionIDString.trim().length() != 0) {
        condition.setConditionId(Long.parseLong(conditionIDString));
        if (rule.getCondition().getConditionType() != null)         conditionCategoryJSON=rule.getCondition().getConditionType().name();
        conditionIdJSON=rule.getCondition().getConditionId().toString();
        condition.save();
      }
      EmailTemplate template;
      if (templateString != null && templateString.trim().length() != 0) {
        template=settingRepo.findEmailTemplate(Long.parseLong(templateString));
        rule.setEmailTemplate((JpaEmailTemplateImpl)template);
        templateJSON=rule.getEmailTemplate().name;
      }
      if (recipientString != null && recipientString.trim().length() != 0) {
        Logger.info(recipientString);
        rule.setRecipientType(RecipientType.valueOf(recipientString));
        recipientTypeJSON=rule.getRecipientType().name();
      }
    }
 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"+ conditionCategoryJSON+ "String_Node_Str"+ conditionIdJSON+ "String_Node_Str"+ conditionDisplayJSON+ "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 {
    Logger.info(recipientString);
    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 conditionCategoryJSON="String_Node_Str";
    String conditionIdJSON="String_Node_Str";
    String conditionDisplayJSON="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));
        condition.setConditionId(null);
        conditionIdJSON=null;
        conditionCategoryJSON=rule.getCondition().getConditionType().name();
        condition.save();
      }
      if (conditionIDString != null && conditionIDString.trim().length() != 0) {
        condition.setConditionId(Long.parseLong(conditionIDString));
        if (rule.getCondition().getConditionType() != null)         conditionCategoryJSON=rule.getCondition().getConditionType().name();
        conditionIdJSON=rule.getCondition().getConditionId().toString();
        condition.save();
      }
      EmailTemplate template;
      if (templateString != null && templateString.trim().length() != 0) {
        template=settingRepo.findEmailTemplate(Long.parseLong(templateString));
        rule.setEmailTemplate((JpaEmailTemplateImpl)template);
        templateJSON=rule.getEmailTemplate().name;
      }
      if (recipientString != null && recipientString.trim().length() != 0) {
        Logger.info(recipientString);
        rule.setRecipientType(RecipientType.valueOf(recipientString));
        recipientTypeJSON=rule.getRecipientType().name();
      }
    }
 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"+ conditionCategoryJSON+ "String_Node_Str"+ conditionIdJSON+ "String_Node_Str"+ conditionDisplayJSON+ "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");
  }
}