Program: 62444
Project: 62444
Buggy source:
@Override protected void onOK(){
  if (!verifyUserInput()) {
    Dialogs.showWarning(Bundle.MSG_Wrong_Value_Text());
    this.getJDialog().requestFocus();
  }
 else {
    String templateContent=this.templateContent.getText();
    if (!resolveTemplateProductCount(templateContent)) {
      Dialogs.showWarning(Bundle.MSG_Wrong_Usage_Array_Text());
      this.getJDialog().requestFocus();
    }
 else {
      super.onOK();
      if (newOperatorDescriptor.getSourceProductCount() == 0) {
        Dialogs.showInformation("String_Node_Str","String_Node_Str");
      }
      if (!newOperatorDescriptor.isFromPackage()) {
        newOperatorDescriptor.setSource(ToolAdapterOperatorDescriptor.SOURCE_USER);
      }
      Map<File,String> templates=new HashMap<>();
      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 -> {
        Object propertyValue=paramsTable.getBindingContext().getBinding(param.getName()).getPropertyValue();
        if (param.isTemplateBefore() || param.isTemplateAfter()) {
          final File paramTemplateFile=new File(propertyValue.toString());
          param.setDefaultValue(paramTemplateFile.getName());
          File fileToAdd;
          if (!newOperatorDescriptor.getAlias().equals(oldOperatorDescriptor.getAlias())) {
            File oldFile=ToolAdapterIO.ensureLocalCopy(paramTemplateFile,oldOperatorDescriptor.getAlias());
            fileToAdd=ToolAdapterIO.ensureLocalCopy(oldFile,newOperatorDescriptor.getAlias());
          }
 else {
            fileToAdd=ToolAdapterIO.ensureLocalCopy(paramTemplateFile,newOperatorDescriptor.getAlias());
          }
          try {
            templates.put(fileToAdd,new String(Files.readAllBytes(Paths.get(fileToAdd.toURI()))));
          }
 catch (          IOException e) {
            logger.severe(e.getMessage());
          }
        }
 else {
          String defaultValueString="String_Node_Str";
          if (propertyValue.getClass().isArray()) {
            defaultValueString=String.join(ArrayConverter.SEPARATOR,Arrays.asList((Object[])propertyValue).stream().map(Object::toString).collect(Collectors.toList()));
          }
 else {
            defaultValueString=propertyValue.toString();
          }
          param.setDefaultValue(defaultValueString);
        }
      }
);
      java.util.List<TemplateParameterDescriptor> remParameters=toolParameterDescriptors.stream().filter(param -> (ToolAdapterConstants.TOOL_SOURCE_PRODUCT_ID.equals(param.getName()) || ToolAdapterConstants.TOOL_SOURCE_PRODUCT_FILE.equals(param.getName()))).collect(Collectors.toList());
      newOperatorDescriptor.removeParamDescriptors(remParameters);
      try {
        if (rbMenuNew.isSelected()) {
          String customMenuLocationText=customMenuLocation.getText();
          if (customMenuLocationText != null && !customMenuLocationText.isEmpty()) {
            newOperatorDescriptor.setMenuLocation(customMenuLocationText);
          }
        }
        String menuLocation=newOperatorDescriptor.getMenuLocation();
        if (menuLocation != null && !menuLocation.startsWith("String_Node_Str")) {
          newOperatorDescriptor.setMenuLocation("String_Node_Str" + menuLocation);
        }
        ToolAdapterIO.removeOperator(oldOperatorDescriptor,true);
        ToolAdapterIO.saveAndRegisterOperator(newOperatorDescriptor,templateContent);
        templates.keySet().stream().forEach(k -> {
          if (!k.exists()) {
            try {
              if (k.createNewFile()) {
                Files.write(Paths.get(k.toURI()),templates.get(k).getBytes(),StandardOpenOption.WRITE);
              }
            }
 catch (            IOException e) {
              logger.severe(e.getMessage());
            }
          }
        }
);
      }
 catch (      Exception e) {
        logger.warning(e.getMessage());
        Dialogs.showError(e.getMessage());
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void onOK(){
  if (!verifyUserInput()) {
    Dialogs.showWarning(Bundle.MSG_Wrong_Value_Text());
    this.getJDialog().requestFocus();
  }
 else {
    String templateContent=this.templateContent.getText();
    if (!resolveTemplateProductCount(templateContent)) {
      Dialogs.showWarning(Bundle.MSG_Wrong_Usage_Array_Text());
      this.getJDialog().requestFocus();
    }
 else {
      super.onOK();
      if (newOperatorDescriptor.getSourceProductCount() == 0) {
        Dialogs.showInformation("String_Node_Str","String_Node_Str");
      }
      if (!newOperatorDescriptor.isFromPackage()) {
        newOperatorDescriptor.setSource(ToolAdapterOperatorDescriptor.SOURCE_USER);
      }
      Map<File,String> templates=new HashMap<>();
      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 -> {
        Object propertyValue=paramsTable.getBindingContext().getBinding(param.getName()).getPropertyValue();
        if (param.isTemplateBefore() || param.isTemplateAfter()) {
          final File paramTemplateFile=new File(propertyValue.toString());
          param.setDefaultValue(paramTemplateFile.getName());
          File fileToAdd;
          if (!newOperatorDescriptor.getAlias().equals(oldOperatorDescriptor.getAlias())) {
            File oldFile=ToolAdapterIO.ensureLocalCopy(paramTemplateFile,oldOperatorDescriptor.getAlias());
            fileToAdd=ToolAdapterIO.ensureLocalCopy(oldFile,newOperatorDescriptor.getAlias());
          }
 else {
            fileToAdd=ToolAdapterIO.ensureLocalCopy(paramTemplateFile,newOperatorDescriptor.getAlias());
          }
          try {
            templates.put(fileToAdd,new String(Files.readAllBytes(Paths.get(fileToAdd.toURI()))));
          }
 catch (          IOException e) {
            logger.severe(e.getMessage());
          }
        }
 else {
          String defaultValueString="String_Node_Str";
          if (propertyValue.getClass().isArray()) {
            defaultValueString=String.join(ArrayConverter.SEPARATOR,Arrays.asList((Object[])propertyValue).stream().map(Object::toString).collect(Collectors.toList()));
          }
 else {
            defaultValueString=propertyValue.toString();
          }
          param.setDefaultValue(defaultValueString);
        }
      }
);
      java.util.List<TemplateParameterDescriptor> remParameters=toolParameterDescriptors.stream().filter(param -> (ToolAdapterConstants.TOOL_SOURCE_PRODUCT_ID.equals(param.getName()) || ToolAdapterConstants.TOOL_SOURCE_PRODUCT_FILE.equals(param.getName()))).collect(Collectors.toList());
      newOperatorDescriptor.removeParamDescriptors(remParameters);
      try {
        if (rbMenuNew.isSelected()) {
          String customMenuLocationText=customMenuLocation.getText();
          if (customMenuLocationText != null && !customMenuLocationText.isEmpty()) {
            newOperatorDescriptor.setMenuLocation(customMenuLocationText);
          }
        }
        String menuLocation=newOperatorDescriptor.getMenuLocation();
        if (menuLocation != null && !menuLocation.startsWith("String_Node_Str")) {
          newOperatorDescriptor.setMenuLocation("String_Node_Str" + menuLocation);
        }
        if (this.currentOperation == OperationType.EDIT) {
          ToolAdapterIO.removeOperator(oldOperatorDescriptor,true);
        }
        ToolAdapterIO.saveAndRegisterOperator(newOperatorDescriptor,templateContent);
        templates.keySet().stream().forEach(k -> {
          if (!k.exists()) {
            try {
              if (k.createNewFile()) {
                Files.write(Paths.get(k.toURI()),templates.get(k).getBytes(),StandardOpenOption.WRITE);
              }
            }
 catch (            IOException e) {
              logger.severe(e.getMessage());
            }
          }
        }
);
      }
 catch (      Exception e) {
        logger.warning(e.getMessage());
        Dialogs.showError(e.getMessage());
      }
    }
  }
}