Program: 189366
Project: 189366
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);
        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) {
        rule.setRecipientType(RecipientType.valueOf(recipientString));
        if (rule.getRecipientType() == RecipientType.AdminGroup) {
          String adminGroupString=params.get("String_Node_Str");
          if (adminGroupString == null) {
            throw new IllegalArgumentException("String_Node_Str");
          }
          Long adminGroupId=Long.parseLong(adminGroupString);
          AdministrativeGroup adminGroup=settingRepo.findAdministrativeGroup(adminGroupId);
          rule.setAdminGroupRecipient((JpaAdministrativeGroupImpl)adminGroup);
        }
 else {
          rule.setAdminGroupRecipient(null);
        }
        recipientTypeJSON=rule.getRecipientType().toString() + (rule.getAdminGroupRecipient() != null ? "String_Node_Str" + rule.getAdminGroupRecipient().getName() + "String_Node_Str" : "String_Node_Str");
      }
    }
 else {
      rule=settingRepo.createWorkflowEmailRule(associatedState);
    }
    rules.add(rule);
    saveModelOrder(rules);
    Logger.info("String_Node_Str","String_Node_Str",0,"String_Node_Str",rule.getId());
    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) {
        rule.setRecipientType(RecipientType.valueOf(recipientString));
        if (rule.getRecipientType() == RecipientType.AdminGroup) {
          String adminGroupString=params.get("String_Node_Str");
          if (adminGroupString == null) {
            throw new IllegalArgumentException("String_Node_Str");
          }
          Long adminGroupId=Long.parseLong(adminGroupString);
          AdministrativeGroup adminGroup=settingRepo.findAdministrativeGroup(adminGroupId);
          rule.setAdminGroupRecipient((JpaAdministrativeGroupImpl)adminGroup);
        }
 else {
          rule.setAdminGroupRecipient(null);
        }
        recipientTypeJSON=rule.getRecipientType().toString() + (rule.getAdminGroupRecipient() != null ? "String_Node_Str" + rule.getAdminGroupRecipient().getName() + "String_Node_Str" : "String_Node_Str");
      }
    }
 else {
      rule=settingRepo.createWorkflowEmailRule(associatedState);
    }
    rules.add(rule);
    saveModelOrder(rules);
    Logger.info("String_Node_Str",context.getPerson().getDisplayName(),context.getPerson().getId(),context.getPerson().getRole(),rule.getId());
    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");
  }
}