Program: 126836
Project: 126836
Buggy source:
private void deleteRepositoryNode(IRepositoryNode repositoryNode,IProxyRepositoryFactory factory) throws PersistenceException, BusinessException {
  if (repositoryNode.getType() == ENodeType.SIMPLE_FOLDER) {
    IPath path=RepositoryNodeUtilities.getPath((RepositoryNode)repositoryNode);
    ERepositoryObjectType objectType=(ERepositoryObjectType)repositoryNode.getProperties(EProperties.CONTENT_TYPE);
    List<IRepositoryNode> repositoryList=repositoryNode.getChildren();
    PersistenceException pex=null;
    BusinessException bex=null;
    for (    IRepositoryNode repositoryNode2 : repositoryList) {
      try {
        deleteRepositoryNode(repositoryNode2,factory);
      }
 catch (      PersistenceException e) {
        pex=e;
      }
catch (      BusinessException e) {
        bex=e;
      }
    }
    if (pex != null) {
      throw pex;
    }
    if (bex != null) {
      throw bex;
    }
    FolderItem folderItem=factory.getFolderItem(ProjectManager.getInstance().getCurrentProject(),objectType,path);
    folderItem.getState().setDeleted(true);
    String fullPath="String_Node_Str";
    FolderItem curItem=folderItem;
    while (curItem.getParent() instanceof FolderItem && ((Item)curItem.getParent()).getParent() instanceof FolderItem) {
      FolderItem parentFolder=(FolderItem)curItem.getParent();
      if ("String_Node_Str".equals(fullPath)) {
        fullPath=parentFolder.getProperty().getLabel() + fullPath;
      }
 else {
        fullPath=parentFolder.getProperty().getLabel() + "String_Node_Str" + fullPath;
      }
      curItem=parentFolder;
    }
    folderItem.getState().setPath(fullPath);
  }
 else {
    IRepositoryViewObject objToDelete=repositoryNode.getObject();
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreService.class)) {
      IDesignerCoreService coreService=(IDesignerCoreService)GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
      if (coreService != null && objToDelete != null && objToDelete.getProperty() != null) {
        Item item=objToDelete.getProperty().getItem();
        IProcess iProcess=coreService.getProcessFromItem(item);
        if (iProcess != null && iProcess instanceof IProcess2) {
          IProcess2 process=(IProcess2)iProcess;
          process.removeProblems4ProcessDeleted();
        }
      }
    }
    factory.deleteObjectLogical(objToDelete);
    removeConnFromSQLExplorer(repositoryNode);
  }
}

Fixed version (ground truth):
private boolean deleteRepositoryNode(IRepositoryNode repositoryNode,IProxyRepositoryFactory factory) throws PersistenceException, BusinessException {
  if (repositoryNode.getType() == ENodeType.SIMPLE_FOLDER) {
    IPath path=RepositoryNodeUtilities.getPath((RepositoryNode)repositoryNode);
    ERepositoryObjectType objectType=(ERepositoryObjectType)repositoryNode.getProperties(EProperties.CONTENT_TYPE);
    List<IRepositoryNode> repositoryList=repositoryNode.getChildren();
    PersistenceException pex=null;
    BusinessException bex=null;
    for (    IRepositoryNode repositoryNode2 : repositoryList) {
      try {
        boolean ret=deleteRepositoryNode(repositoryNode2,factory);
        if (!ret) {
          return false;
        }
      }
 catch (      PersistenceException e) {
        pex=e;
      }
catch (      BusinessException e) {
        bex=e;
      }
    }
    if (pex != null) {
      throw pex;
    }
    if (bex != null) {
      throw bex;
    }
    FolderItem folderItem=factory.getFolderItem(ProjectManager.getInstance().getCurrentProject(),objectType,path);
    folderItem.getState().setDeleted(true);
    String fullPath="String_Node_Str";
    FolderItem curItem=folderItem;
    while (curItem.getParent() instanceof FolderItem && ((Item)curItem.getParent()).getParent() instanceof FolderItem) {
      FolderItem parentFolder=(FolderItem)curItem.getParent();
      if ("String_Node_Str".equals(fullPath)) {
        fullPath=parentFolder.getProperty().getLabel() + fullPath;
      }
 else {
        fullPath=parentFolder.getProperty().getLabel() + "String_Node_Str" + fullPath;
      }
      curItem=parentFolder;
    }
    folderItem.getState().setPath(fullPath);
    return true;
  }
 else {
    final DeleteActionCache deleteActionCache=DeleteActionCache.getInstance();
    deleteActionCache.setGetAlways(false);
    deleteActionCache.setDocRefresh(false);
    deleteActionCache.createRecords();
    final IRepositoryViewObject objToDelete=repositoryNode.getObject();
    final boolean[] enableDeleting=new boolean[1];
    enableDeleting[0]=true;
    final List<ContextReferenceBean> checkContext=checkContextFromProcess(factory,deleteActionCache,(RepositoryNode)repositoryNode);
    if (checkContext.size() > 0) {
      Display.getDefault().syncExec(new Runnable(){
        @Override public void run(){
          ContextReferenceDialog dialog=new ContextReferenceDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),objToDelete,checkContext);
          int returnCode=dialog.open();
switch (returnCode) {
case Window.OK:
            enableDeleting[0]=true;
          break;
case Window.CANCEL:
        enableDeleting[0]=false;
      break;
  }
}
}
);
}
if (!enableDeleting[0]) {
return false;
}
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreService.class)) {
IDesignerCoreService coreService=(IDesignerCoreService)GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
if (coreService != null && objToDelete != null && objToDelete.getProperty() != null) {
Item item=objToDelete.getProperty().getItem();
IProcess iProcess=coreService.getProcessFromItem(item);
if (iProcess != null && iProcess instanceof IProcess2) {
  IProcess2 process=(IProcess2)iProcess;
  process.removeProblems4ProcessDeleted();
}
}
}
factory.deleteObjectLogical(objToDelete);
removeConnFromSQLExplorer(repositoryNode);
return true;
}
}