Program: 62447
Project: 62447
Buggy source:
@Override protected void onApply(){
  final Product[] sourceProducts=form.getSourceProducts();
  List<ParameterDescriptor> descriptors=Arrays.stream(operatorDescriptor.getParameterDescriptors()).filter(p -> ToolAdapterConstants.TOOL_TARGET_PRODUCT_FILE.equals(p.getName())).collect(Collectors.toList());
  String templateContents="String_Node_Str";
  try {
    templateContents=ToolAdapterIO.readOperatorTemplate(operatorDescriptor.getName());
  }
 catch (  IOException ignored) {
  }
  if (Arrays.stream(sourceProducts).anyMatch(p -> p == null)) {
    Dialogs.Answer decision=Dialogs.requestDecision("String_Node_Str",Bundle.NoSourceProductWarning_Text(),false,ToolAdapterOptionsController.PREFERENCE_KEY_SHOW_EMPTY_PRODUCT_WARNING);
    if (decision.equals(Dialogs.Answer.NO)) {
      return;
    }
  }
  if (descriptors.size() == 1 && form.getPropertyValue(ToolAdapterConstants.TOOL_TARGET_PRODUCT_FILE) == null && templateContents.contains("String_Node_Str" + ToolAdapterConstants.TOOL_TARGET_PRODUCT_FILE)) {
    Dialogs.showWarning(Bundle.RequiredTargetProductMissingWarning_Text());
  }
 else {
    if (!canApply()) {
      displayWarnings();
      AbstractAdapterEditor dialog=AbstractAdapterEditor.createEditorDialog(appContext,getJDialog(),operatorDescriptor,false);
      dialog.getJDialog().addWindowListener(new WindowAdapter(){
        @Override public void windowClosed(        WindowEvent e){
          super.windowClosed(e);
          onOperatorDescriptorChanged(dialog.getUpdatedOperatorDescriptor());
        }
      }
);
      dialog.show();
    }
 else {
      if (validateUserInput()) {
        String productDir=targetProductSelector.getModel().getProductDir().getAbsolutePath();
        appContext.getPreferences().setPropertyString(SaveProductAsAction.PREFERENCES_KEY_LAST_PRODUCT_DIR,productDir);
        Map<String,Product> sourceProductMap=new HashMap<>();
        if (sourceProducts.length > 0) {
          sourceProductMap.put(SOURCE_PRODUCT_FIELD,sourceProducts[0]);
        }
        Operator op=GPF.getDefaultInstance().createOperator(operatorDescriptor.getName(),parameterSupport.getParameterMap(),sourceProductMap,null);
        op.setSourceProducts(sourceProducts);
        operatorTask=new OperatorTask(op,ToolAdapterExecutionDialog.this::operatorCompleted);
        ProgressHandle progressHandle=ProgressHandleFactory.createHandle(this.getTitle());
        String progressPattern=operatorDescriptor.getProgressPattern();
        ((ToolAdapterOp)op).setProgressMonitor(new ProgressWrapper(progressHandle,progressPattern == null || progressPattern.isEmpty(),form.shouldDisplayOutput()));
        ProgressUtils.runOffEventThreadWithProgressDialog(operatorTask,this.getTitle(),progressHandle,true,1,1);
      }
 else {
        if (warnings.size() > 0) {
          displayWarnings();
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void onApply(){
  final Product[] sourceProducts=form.getSourceProducts();
  List<ParameterDescriptor> descriptors=Arrays.stream(operatorDescriptor.getParameterDescriptors()).filter(p -> ToolAdapterConstants.TOOL_TARGET_PRODUCT_FILE.equals(p.getName())).collect(Collectors.toList());
  String templateContents="String_Node_Str";
  try {
    templateContents=ToolAdapterIO.readOperatorTemplate(operatorDescriptor.getName());
  }
 catch (  IOException ignored) {
  }
  if (Arrays.stream(sourceProducts).anyMatch(p -> p == null)) {
    Dialogs.Answer decision=Dialogs.requestDecision("String_Node_Str",Bundle.NoSourceProductWarning_Text(),false,ToolAdapterOptionsController.PREFERENCE_KEY_SHOW_EMPTY_PRODUCT_WARNING);
    if (decision.equals(Dialogs.Answer.NO)) {
      return;
    }
  }
  if (descriptors.size() == 1 && form.getPropertyValue(ToolAdapterConstants.TOOL_TARGET_PRODUCT_FILE) == null && templateContents.contains("String_Node_Str" + ToolAdapterConstants.TOOL_TARGET_PRODUCT_FILE)) {
    Dialogs.showWarning(Bundle.RequiredTargetProductMissingWarning_Text());
  }
 else {
    if (!canApply()) {
      displayWarnings();
      AbstractAdapterEditor dialog=AbstractAdapterEditor.createEditorDialog(appContext,getJDialog(),operatorDescriptor,OperationType.EDIT);
      dialog.getJDialog().addWindowListener(new WindowAdapter(){
        @Override public void windowClosed(        WindowEvent e){
          super.windowClosed(e);
          onOperatorDescriptorChanged(dialog.getUpdatedOperatorDescriptor());
        }
      }
);
      dialog.show();
    }
 else {
      if (validateUserInput()) {
        String productDir=targetProductSelector.getModel().getProductDir().getAbsolutePath();
        appContext.getPreferences().setPropertyString(SaveProductAsAction.PREFERENCES_KEY_LAST_PRODUCT_DIR,productDir);
        Map<String,Product> sourceProductMap=new HashMap<>();
        if (sourceProducts.length > 0) {
          sourceProductMap.put(SOURCE_PRODUCT_FIELD,sourceProducts[0]);
        }
        Operator op=GPF.getDefaultInstance().createOperator(operatorDescriptor.getName(),parameterSupport.getParameterMap(),sourceProductMap,null);
        op.setSourceProducts(sourceProducts);
        operatorTask=new OperatorTask(op,ToolAdapterExecutionDialog.this::operatorCompleted);
        ProgressHandle progressHandle=ProgressHandleFactory.createHandle(this.getTitle());
        String progressPattern=operatorDescriptor.getProgressPattern();
        ((ToolAdapterOp)op).setProgressMonitor(new ProgressWrapper(progressHandle,progressPattern == null || progressPattern.isEmpty(),form.shouldDisplayOutput()));
        ProgressUtils.runOffEventThreadWithProgressDialog(operatorTask,this.getTitle(),progressHandle,true,1,1);
      }
 else {
        if (warnings.size() > 0) {
          displayWarnings();
        }
      }
    }
  }
}