Program: 95888
Project: 95888
Buggy source:
/** 
 * Adds a new CAP to the given workVersion SpecTestCase at the given position and, if successful, sets the given editor dirty.
 * @param specTcGUI the GUI SpecTestCase for the NewCapDialog
 * @param workTC the workversion of the SpecTestCase
 * @param position the position to add
 * @param tse the editor.
 */
private void addCap(ISpecTestCasePO specTcGUI,ISpecTestCasePO workTC,Integer position,AbstractTestCaseEditor tse){
  final NewCAPDialog dialog=new NewCAPDialog(getActiveShell(),specTcGUI,tse.getEditorHelper().getEditSupport().getCompMapper());
  dialog.create();
  DialogUtils.setWidgetNameForModalDialog(dialog);
  dialog.open();
  if (dialog.getReturnCode() != Window.OK) {
    return;
  }
  final String componentType=dialog.getComponentType();
  final String capName=dialog.getCapName();
  final String action=dialog.getActionName();
  final String componentName=dialog.getComponentName();
  final ICapPO cap=CapBP.createCapWithDefaultParams(capName,componentName,componentType,action);
  final IWritableComponentNameMapper compMapper=tse.getEditorHelper().getEditSupport().getCompMapper();
  CompSystem compSystem=ComponentBuilder.getInstance().getCompSystem();
  Component comp=compSystem.findComponent(componentType);
  try {
    cap.setComponentName(null);
    if (comp instanceof ConcreteComponent && !((ConcreteComponent)comp).hasDefaultMapping()) {
      ComponentNamesBP.getInstance().setCompName(cap,componentName,CompNameCreationContext.STEP,compMapper);
    }
    workTC.addNode(position,cap);
    tse.getEditorHelper().setDirty(true);
    DataEventDispatcher.getInstance().fireDataChangedListener(cap,DataState.Added,UpdateState.onlyInEditor);
  }
 catch (  IncompatibleTypeException e) {
    ErrorHandlingUtil.createMessageDialog(e,e.getErrorMessageParams(),null);
  }
catch (  PMException pme) {
    PMExceptionHandler.handlePMExceptionForEditor(pme,tse);
  }
}

Fixed version (ground truth):
/** 
 * Adds a new CAP to the given workVersion SpecTestCase at the given position and, if successful, sets the given editor dirty.
 * @param specTcGUI the GUI SpecTestCase for the NewCapDialog
 * @param workTC the workversion of the SpecTestCase
 * @param position the position to add
 * @param tse the editor.
 */
private void addCap(ISpecTestCasePO specTcGUI,ISpecTestCasePO workTC,Integer position,AbstractTestCaseEditor tse){
  final NewCAPDialog dialog=new NewCAPDialog(getActiveShell(),specTcGUI,tse.getEditorHelper().getEditSupport().getCompMapper());
  dialog.create();
  DialogUtils.setWidgetNameForModalDialog(dialog);
  dialog.open();
  if (dialog.getReturnCode() != Window.OK) {
    return;
  }
  final String componentType=dialog.getComponentType();
  final String capName=dialog.getCapName();
  final String action=dialog.getActionName();
  final String componentName=dialog.getComponentName();
  final ICapPO cap=CapBP.createCapWithDefaultParams(capName,componentName,componentType,action);
  final IWritableComponentNameMapper compMapper=tse.getEditorHelper().getEditSupport().getCompMapper();
  CompSystem compSystem=ComponentBuilder.getInstance().getCompSystem();
  Component comp=compSystem.findComponent(componentType);
  try {
    cap.setComponentName(null);
    boolean hasDefaultMapping=false;
    if (comp.isConcrete()) {
      hasDefaultMapping=((ConcreteComponent)comp).hasDefaultMapping();
    }
    if (!hasDefaultMapping) {
      ComponentNamesBP.getInstance().setCompName(cap,componentName,CompNameCreationContext.STEP,compMapper);
    }
    workTC.addNode(position,cap);
    tse.getEditorHelper().setDirty(true);
    DataEventDispatcher.getInstance().fireDataChangedListener(cap,DataState.Added,UpdateState.onlyInEditor);
  }
 catch (  IncompatibleTypeException e) {
    ErrorHandlingUtil.createMessageDialog(e,e.getErrorMessageParams(),null);
  }
catch (  PMException pme) {
    PMExceptionHandler.handlePMExceptionForEditor(pme,tse);
  }
}