Program: 95573
Project: 95573
Buggy source:
/** 
 * Deletes the given Component Name from the object map.
 * @param toDelete The Component Name to delete.
 * @return the category to which the Component Name belonged before it wasdeleted.
 */
public IObjectMappingCategoryPO deleteCompName(IComponentNamePO toDelete){
  IObjectMappingCategoryPO originalCategory=null;
  IWritableComponentNameMapper compNameMapper=getEditor().getEditorHelper().getEditSupport().getCompMapper();
  IObjectMappingAssoziationPO parent=getAssociation(toDelete.getGuid());
  try {
    compNameMapper.changeReuse(parent,toDelete.getGuid(),null);
    IObjectMappingCategoryPO category=parent.getCategory();
    originalCategory=category;
    if (parent.getLogicalNames().isEmpty()) {
      originalCategory.removeAssociation(parent);
      if (parent.getTechnicalName() != null) {
        Stack<String> catPath=new Stack<String>();
        while (category.getParent() != null) {
          catPath.push(category.getName());
          category=category.getParent();
        }
        IObjectMappingCategoryPO newCategory=getEditor().getAut().getObjMap().getUnmappedTechnicalCategory();
        while (!catPath.isEmpty()) {
          String catName=catPath.pop();
          IObjectMappingCategoryPO subcategory=findSubcategory(newCategory,catName);
          if (subcategory == null) {
            subcategory=PoMaker.createObjectMappingCategoryPO(catName);
            newCategory.addCategory(subcategory);
          }
          newCategory=subcategory;
        }
        newCategory.addAssociation(parent);
      }
 else {
        getEditor().getEditorHelper().getEditSupport().getSession().remove(parent);
      }
    }
    DataEventDispatcher.getInstance().fireDataChangedListener(getEditor().getAut().getObjMap(),DataState.StructureModified,UpdateState.onlyInEditor);
  }
 catch (  IncompatibleTypeException ite) {
    ErrorHandlingUtil.createMessageDialog(ite,ite.getErrorMessageParams(),null);
  }
catch (  PMException pme) {
    PMExceptionHandler.handlePMExceptionForEditor(pme,getEditor());
  }
  return originalCategory;
}

Fixed version (ground truth):
/** 
 * Deletes the given Component Name from the object map.
 * @param toDelete The Component Name to delete.
 * @return the category to which the Component Name belonged before it wasdeleted.
 */
public IObjectMappingCategoryPO deleteCompName(IComponentNamePO toDelete){
  IObjectMappingCategoryPO originalCategory=null;
  IWritableComponentNameMapper compNameMapper=getEditor().getEditorHelper().getEditSupport().getCompMapper();
  IObjectMappingAssoziationPO parent=getAssociation(toDelete.getGuid());
  try {
    compNameMapper.changeReuse(parent,toDelete.getGuid(),null);
    IObjectMappingCategoryPO category=parent.getCategory();
    originalCategory=category;
    if (parent.getLogicalNames().isEmpty()) {
      if (originalCategory != null) {
        originalCategory.removeAssociation(parent);
      }
      if (parent.getTechnicalName() != null) {
        Stack<String> catPath=new Stack<String>();
        while (category.getParent() != null) {
          catPath.push(category.getName());
          category=category.getParent();
        }
        IObjectMappingCategoryPO newCategory=getEditor().getAut().getObjMap().getUnmappedTechnicalCategory();
        while (!catPath.isEmpty()) {
          String catName=catPath.pop();
          IObjectMappingCategoryPO subcategory=findSubcategory(newCategory,catName);
          if (subcategory == null) {
            subcategory=PoMaker.createObjectMappingCategoryPO(catName);
            newCategory.addCategory(subcategory);
          }
          newCategory=subcategory;
        }
        newCategory.addAssociation(parent);
      }
 else {
        getEditor().getEditorHelper().getEditSupport().getSession().remove(parent);
      }
    }
    DataEventDispatcher.getInstance().fireDataChangedListener(getEditor().getAut().getObjMap(),DataState.StructureModified,UpdateState.onlyInEditor);
  }
 catch (  IncompatibleTypeException ite) {
    ErrorHandlingUtil.createMessageDialog(ite,ite.getErrorMessageParams(),null);
  }
catch (  PMException pme) {
    PMExceptionHandler.handlePMExceptionForEditor(pme,getEditor());
  }
  return originalCategory;
}