Program: 129481
Project: 129481
Buggy source:
protected void restoreNode(RepositoryNode node){
  try {
    RestoreFolderUtil restoreFolder=new RestoreFolderUtil();
    ERepositoryObjectType nodeType=(ERepositoryObjectType)(node).getProperties(EProperties.CONTENT_TYPE);
    if (nodeType == null) {
      return;
    }
    if (nodeType.isSubItem()) {
      ConnectionItem item=(ConnectionItem)node.getObject().getProperty().getItem();
      AbstractMetadataObject abstractMetadataObject=((ISubRepositoryObject)node.getObject()).getAbstractMetadataObject();
      SubItemHelper.setDeleted(abstractMetadataObject,false);
      final String id=item.getProperty().getId();
      Item tmpItem=procItems.get(id);
      if (tmpItem == null) {
        procItems.put(id,item);
      }
      connections.add(node.getObject());
    }
 else {
      String oldPath=node.getObject().getProperty().getItem().getState().getPath();
      IPath path=new Path(oldPath);
      if (node.getObject().getProperty().getItem() instanceof FolderItem) {
        node.getObject().getProperty().getItem().getState().setDeleted(false);
      }
 else {
        RestoreObjectAction restoreObjectAction=RestoreObjectAction.getInstance();
        restoreObjectAction.execute(node,null,path);
      }
      ProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
      if (nodeType.equals(ERepositoryObjectType.PROCESS) || nodeType.equals(ERepositoryObjectType.JOBLET) && node.getObject() != null) {
        IRepositoryViewObject docObject=factory.getLastVersion(node.getObject().getId() + "String_Node_Str");
        if (docObject != null) {
          factory.restoreObject(docObject,path);
        }
      }
    }
    if (nodeType == ERepositoryObjectType.JOBLET) {
      needToUpdatePalette=true;
    }
    if (nodeType.isSubItem()) {
      RepositoryNode parent=node.getParent();
      if (parent.getObject() == null) {
        parent=parent.getParent();
      }
      nodeType=parent.getObjectType();
    }
    if (node.hasChildren()) {
      for (      IRepositoryNode childNode : node.getChildren()) {
        restoreNode((RepositoryNode)childNode);
      }
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}

Fixed version (ground truth):
protected void restoreNode(RepositoryNode node){
  try {
    RestoreFolderUtil restoreFolder=new RestoreFolderUtil();
    ERepositoryObjectType nodeType=(ERepositoryObjectType)(node).getProperties(EProperties.CONTENT_TYPE);
    if (nodeType == null) {
      return;
    }
    if (nodeType.isSubItem()) {
      ConnectionItem item=(ConnectionItem)node.getObject().getProperty().getItem();
      AbstractMetadataObject abstractMetadataObject=((ISubRepositoryObject)node.getObject()).getAbstractMetadataObject();
      SubItemHelper.setDeleted(abstractMetadataObject,false);
      final String id=item.getProperty().getId();
      Item tmpItem=procItems.get(id);
      if (tmpItem == null) {
        procItems.put(id,item);
      }
      connections.add(node.getObject());
    }
 else {
      String oldPath=node.getObject().getProperty().getItem().getState().getPath();
      IPath path=new Path(oldPath);
      if (node.getObject().getProperty().getItem() instanceof FolderItem) {
        node.getObject().getProperty().getItem().getState().setDeleted(false);
      }
 else {
        RestoreObjectAction restoreObjectAction=RestoreObjectAction.getInstance();
        restoreObjectAction.execute(node,null,path);
      }
      ProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
      if (nodeType.equals(ERepositoryObjectType.PROCESS) || nodeType.equals(ERepositoryObjectType.JOBLET) && node.getObject() != null) {
        IRepositoryViewObject docObject=factory.getLastVersion(node.getObject().getId() + "String_Node_Str");
        if (docObject != null) {
          factory.restoreObject(docObject,path);
          RepositoryManager.refresh(docObject.getRepositoryObjectType());
        }
      }
    }
    if (nodeType == ERepositoryObjectType.JOBLET) {
      needToUpdatePalette=true;
    }
    if (nodeType.isSubItem()) {
      RepositoryNode parent=node.getParent();
      if (parent.getObject() == null) {
        parent=parent.getParent();
      }
      nodeType=parent.getObjectType();
    }
    if (node.hasChildren()) {
      for (      IRepositoryNode childNode : node.getChildren()) {
        restoreNode((RepositoryNode)childNode);
      }
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}