Program: 62509
Project: 62509
Buggy source:
@Override protected void onOK(){
  if (!verifyUserInput()) {
    this.getJDialog().requestFocus();
  }
 else {
    super.onOK();
    if (!this.operatorIsNew) {
      ToolAdapterActionRegistrar.removeOperatorMenu(oldOperatorDescriptor);
      ToolAdapterIO.removeOperator(oldOperatorDescriptor,false);
    }
    String oldOperatorName=oldOperatorDescriptor.getName();
    if (oldOperatorDescriptor.isSystem() && oldOperatorName.equals(newOperatorDescriptor.getName())) {
      newOperatorDescriptor.setName(newOperatorDescriptor.getName() + "String_Node_Str");
      newOperatorDescriptor.setAlias(newOperatorDescriptor.getAlias() + "String_Node_Str");
    }
    newOperatorDescriptor.setSystem(false);
    if (!ToolAdapterOperatorDescriptor.SOURCE_PACKAGE.equals(newOperatorDescriptor.getSource())) {
      newOperatorDescriptor.setSource(ToolAdapterOperatorDescriptor.SOURCE_USER);
    }
    newOperatorDescriptor.setTemplateFileLocation(newOperatorDescriptor.getAlias() + ToolAdapterConstants.TOOL_VELO_TEMPLATE_SUFIX);
    java.util.List<TemplateParameterDescriptor> toolParameterDescriptors=newOperatorDescriptor.getToolParameterDescriptors();
    toolParameterDescriptors.stream().filter(param -> paramsTable.getBindingContext().getBinding(param.getName()) != null).filter(param -> paramsTable.getBindingContext().getBinding(param.getName()).getPropertyValue() != null).forEach(param -> {
      if (param.isTemplateBefore() || param.isTemplateAfter()) {
        param.setDefaultValue(ToolAdapterIO.prettifyTemplateParameterPath(new File(paramsTable.getBindingContext().getBinding(param.getName()).getPropertyValue().toString()),newOperatorDescriptor.getAlias()).toString());
      }
 else {
        param.setDefaultValue(paramsTable.getBindingContext().getBinding(param.getName()).getPropertyValue().toString());
      }
    }
);
    java.util.List<TemplateParameterDescriptor> remParameters=toolParameterDescriptors.stream().filter(param -> ToolAdapterConstants.TOOL_SOURCE_PRODUCT_ID.equals(param.getName())).collect(Collectors.toList());
    newOperatorDescriptor.removeParamDescriptors(remParameters);
    try {
      String menuLocation=newOperatorDescriptor.getMenuLocation();
      if (menuLocation != null && !menuLocation.startsWith("String_Node_Str")) {
        newOperatorDescriptor.setMenuLocation("String_Node_Str" + menuLocation);
      }
      String templateContent=this.templateContent.getText();
      int idx=templateContent.lastIndexOf(ToolAdapterConstants.TOOL_SOURCE_PRODUCT_ID + "String_Node_Str");
      if (idx > 0) {
        String value=templateContent.substring(idx + (ToolAdapterConstants.TOOL_SOURCE_PRODUCT_ID + "String_Node_Str").length(),templateContent.indexOf("String_Node_Str",idx));
        int maxNum=Integer.valueOf(value) + 1;
        newOperatorDescriptor.setSourceProductCount(maxNum);
      }
 else {
        idx=templateContent.lastIndexOf(ToolAdapterConstants.TOOL_SOURCE_PRODUCT_FILE + "String_Node_Str");
        if (idx > 0) {
          String value=templateContent.substring(idx + (ToolAdapterConstants.TOOL_SOURCE_PRODUCT_FILE + "String_Node_Str").length(),templateContent.indexOf("String_Node_Str",idx));
          int maxNum=Integer.valueOf(value) + 1;
          newOperatorDescriptor.setSourceProductCount(maxNum);
        }
      }
      ToolAdapterIO.saveAndRegisterOperator(newOperatorDescriptor,templateContent);
      ToolAdapterActionRegistrar.registerOperatorMenu(newOperatorDescriptor);
    }
 catch (    Exception e) {
      logger.warning(e.getMessage());
      SnapDialogs.showError(e.getMessage());
    }
  }
}

Fixed version (ground truth):
@Override protected void onOK(){
  if (!verifyUserInput()) {
    this.getJDialog().requestFocus();
  }
 else {
    super.onOK();
    if (!this.operatorIsNew) {
      ToolAdapterActionRegistrar.removeOperatorMenu(oldOperatorDescriptor);
      ToolAdapterIO.removeOperator(oldOperatorDescriptor,false);
    }
    String oldOperatorName=oldOperatorDescriptor.getName();
    if (oldOperatorDescriptor.isSystem() && oldOperatorName.equals(newOperatorDescriptor.getName())) {
      newOperatorDescriptor.setName(newOperatorDescriptor.getName() + "String_Node_Str");
      newOperatorDescriptor.setAlias(newOperatorDescriptor.getAlias() + "String_Node_Str");
    }
    newOperatorDescriptor.setSystem(false);
    if (!ToolAdapterOperatorDescriptor.SOURCE_PACKAGE.equals(newOperatorDescriptor.getSource())) {
      newOperatorDescriptor.setSource(ToolAdapterOperatorDescriptor.SOURCE_USER);
    }
    newOperatorDescriptor.setTemplateFileLocation(newOperatorDescriptor.getAlias() + ToolAdapterConstants.TOOL_VELO_TEMPLATE_SUFIX);
    java.util.List<TemplateParameterDescriptor> toolParameterDescriptors=newOperatorDescriptor.getToolParameterDescriptors();
    toolParameterDescriptors.stream().filter(param -> paramsTable.getBindingContext().getBinding(param.getName()) != null).filter(param -> paramsTable.getBindingContext().getBinding(param.getName()).getPropertyValue() != null).forEach(param -> {
      if (param.isTemplateBefore() || param.isTemplateAfter()) {
        param.setDefaultValue(ToolAdapterIO.prettifyTemplateParameterPath(new File(paramsTable.getBindingContext().getBinding(param.getName()).getPropertyValue().toString()),newOperatorDescriptor.getAlias()).toString());
      }
 else {
        Object defaultValue=paramsTable.getBindingContext().getBinding(param.getName()).getPropertyValue();
        String defaultValueString="String_Node_Str";
        if (defaultValue.getClass().isArray()) {
          defaultValueString=String.join(ArrayConverter.SEPARATOR,Arrays.asList((Object[])defaultValue).stream().map(value -> value.toString()).collect(Collectors.toList()));
        }
 else {
          defaultValueString=defaultValue.toString();
        }
        param.setDefaultValue(defaultValueString);
      }
    }
);
    java.util.List<TemplateParameterDescriptor> remParameters=toolParameterDescriptors.stream().filter(param -> ToolAdapterConstants.TOOL_SOURCE_PRODUCT_ID.equals(param.getName())).collect(Collectors.toList());
    newOperatorDescriptor.removeParamDescriptors(remParameters);
    try {
      String menuLocation=newOperatorDescriptor.getMenuLocation();
      if (menuLocation != null && !menuLocation.startsWith("String_Node_Str")) {
        newOperatorDescriptor.setMenuLocation("String_Node_Str" + menuLocation);
      }
      String templateContent=this.templateContent.getText();
      int idx=templateContent.lastIndexOf(ToolAdapterConstants.TOOL_SOURCE_PRODUCT_ID + "String_Node_Str");
      if (idx > 0) {
        String value=templateContent.substring(idx + (ToolAdapterConstants.TOOL_SOURCE_PRODUCT_ID + "String_Node_Str").length(),templateContent.indexOf("String_Node_Str",idx));
        int maxNum=Integer.valueOf(value) + 1;
        newOperatorDescriptor.setSourceProductCount(maxNum);
      }
 else {
        idx=templateContent.lastIndexOf(ToolAdapterConstants.TOOL_SOURCE_PRODUCT_FILE + "String_Node_Str");
        if (idx > 0) {
          String value=templateContent.substring(idx + (ToolAdapterConstants.TOOL_SOURCE_PRODUCT_FILE + "String_Node_Str").length(),templateContent.indexOf("String_Node_Str",idx));
          int maxNum=Integer.valueOf(value) + 1;
          newOperatorDescriptor.setSourceProductCount(maxNum);
        }
      }
      ToolAdapterIO.saveAndRegisterOperator(newOperatorDescriptor,templateContent);
      ToolAdapterActionRegistrar.registerOperatorMenu(newOperatorDescriptor);
    }
 catch (    Exception e) {
      logger.warning(e.getMessage());
      SnapDialogs.showError(e.getMessage());
    }
  }
}