Program: 126759
Project: 126759
Buggy source:
@Override public Set<ItemReferenceBean> checkItemReferenceBeans(IProxyRepositoryFactory factory,DeleteActionCache deleteActionCache,IRepositoryViewObject object){
  Item nodeItem=object.getProperty().getItem();
  boolean needCheckJobIfUsedInProcess=false;
  if (nodeItem instanceof ProcessItem) {
    needCheckJobIfUsedInProcess=true;
  }
  Set<ItemReferenceBean> list=new HashSet<ItemReferenceBean>();
  if (needCheckJobIfUsedInProcess) {
    Property property=object.getProperty();
    if (property != null) {
      String label=property.getLabel();
      String version=property.getVersion();
      ERepositoryObjectType type=object.getRepositoryObjectType();
      boolean isItemDeleted=factory.getStatus(object) == ERepositoryStatus.DELETED;
      Item item=property.getItem();
      if (!(item instanceof ProcessItem)) {
        return list;
      }
      EList<?> nodesList=null;
      Set<Project> refParentProjects=new HashSet<Project>();
      try {
        refParentProjects.add(ProjectManager.getInstance().getCurrentProject());
        refParentProjects.addAll(ProjectManager.getInstance().getReferencedProjects());
        for (        Project refP : refParentProjects) {
          List<IRepositoryViewObject> processes=factory.getAll(refP,ERepositoryObjectType.PROCESS,true);
          deleteActionCache.setProcessList(processes);
          for (          IRepositoryViewObject process : deleteActionCache.getProcessList()) {
            Property property2=process.getProperty();
            boolean isDelete=factory.getStatus(process) == ERepositoryStatus.DELETED;
            Item item2=property2.getItem();
            if (item == item2) {
              continue;
            }
            if (!isOpenedItem(item2,deleteActionCache.getOpenProcessMap())) {
              if (item2 instanceof ProcessItem) {
                nodesList=((ProcessItem)item2).getProcess().getNode();
              }
            }
            if (nodesList != null) {
              for (              Object object2 : nodesList) {
                if (object2 instanceof NodeType) {
                  NodeType nodeType=(NodeType)object2;
                  boolean equals=false;
                  if ("String_Node_Str".equals(nodeType.getComponentName())) {
                    for (                    Object obj : nodeType.getElementParameter()) {
                      if (obj != null && obj instanceof ElementParameterType) {
                        ElementParameterType param=(ElementParameterType)obj;
                        if ("String_Node_Str".equals(param.getName())) {
                          if (property.getId().equals(param.getValue())) {
                            equals=true;
                          }
                        }
                      }
                    }
                  }
                  if (equals) {
                    String path=item2.getState().getPath();
                    boolean found=false;
                    ItemReferenceBean bean=new ItemReferenceBean();
                    bean.setItemName(label);
                    bean.setItemVersion(version);
                    bean.setItemType(type);
                    bean.setItemDeleted(isItemDeleted);
                    bean.setReferenceItemName(property2.getLabel());
                    bean.setReferenceItemVersion(property2.getVersion());
                    bean.setReferenceItemType(process.getRepositoryObjectType());
                    bean.setReferenceItemPath(path);
                    bean.setReferenceProjectName(refP.getLabel());
                    bean.setReferenceItemDeleted(isDelete);
                    for (                    ItemReferenceBean b : list) {
                      if (b.equals(bean)) {
                        found=true;
                        b.addNodeNum();
                        break;
                      }
                    }
                    if (!found) {
                      list.add(bean);
                    }
                  }
                }
              }
            }
          }
          for (          IProcess2 openedProcess : deleteActionCache.getOpenedProcessList()) {
            for (            INode node : openedProcess.getGraphicalNodes()) {
              boolean equals=false;
              IElementParameter processTypeParam=node.getElementParameter(PROCESS_TYPE_PROCESS);
              if (processTypeParam != null && property.getId().equals(processTypeParam.getValue())) {
                equals=true;
              }
              boolean isDelete=factory.getStatus(openedProcess) == ERepositoryStatus.DELETED;
              Property property2=openedProcess.getProperty();
              Item item2=property2.getItem();
              String path=item2.getState().getPath();
              if (equals) {
                boolean found=false;
                ItemReferenceBean bean=new ItemReferenceBean();
                bean.setItemName(label);
                bean.setItemVersion(version);
                bean.setItemType(type);
                bean.setItemDeleted(isItemDeleted);
                bean.setReferenceItemName(property2.getLabel());
                bean.setReferenceItemVersion(property2.getVersion());
                bean.setReferenceItemType(ERepositoryObjectType.getItemType(item2));
                bean.setReferenceItemPath(path);
                bean.setReferenceProjectName(refP.getLabel());
                bean.setReferenceItemDeleted(isDelete);
                for (                ItemReferenceBean b : list) {
                  if (b.equals(bean)) {
                    found=true;
                    b.addNodeNum();
                    break;
                  }
                }
                if (!found) {
                  list.add(bean);
                }
              }
            }
          }
        }
      }
 catch (      PersistenceException e) {
        ExceptionHandler.process(e);
      }
    }
  }
  Iterator<ItemReferenceBean> it=list.iterator();
  while (it.hasNext()) {
    ItemReferenceBean bean=it.next();
    if ((!bean.isItemDeleted() && bean.isReferenceItemDeleted()) || (bean.isItemDeleted() && bean.isReferenceItemDeleted() && isItemInDeleteList(bean,true)) || (!bean.isItemDeleted() && !bean.isReferenceItemDeleted() && isItemInDeleteList(bean,true))) {
      it.remove();
    }
  }
  return list;
}

Fixed version (ground truth):
@Override public Set<ItemReferenceBean> checkItemReferenceBeans(IProxyRepositoryFactory factory,DeleteActionCache deleteActionCache,IRepositoryViewObject object){
  Item nodeItem=object.getProperty().getItem();
  boolean needCheckJobIfUsedInProcess=false;
  if (nodeItem instanceof ProcessItem) {
    needCheckJobIfUsedInProcess=true;
  }
  Set<ItemReferenceBean> list=new HashSet<ItemReferenceBean>();
  if (needCheckJobIfUsedInProcess) {
    Property property=object.getProperty();
    if (property != null) {
      String label=property.getLabel();
      String version=property.getVersion();
      ERepositoryObjectType type=object.getRepositoryObjectType();
      boolean isItemDeleted=factory.getStatus(object) == ERepositoryStatus.DELETED;
      Item item=property.getItem();
      if (!(item instanceof ProcessItem)) {
        return list;
      }
      EList<?> nodesList=null;
      Set<Project> refParentProjects=new HashSet<Project>();
      try {
        refParentProjects.add(ProjectManager.getInstance().getCurrentProject());
        refParentProjects.addAll(ProjectManager.getInstance().getReferencedProjects());
        for (        Project refP : refParentProjects) {
          List<IRepositoryViewObject> processes=factory.getAll(refP,ERepositoryObjectType.PROCESS,true);
          deleteActionCache.setProcessList(processes);
          for (          IRepositoryViewObject process : deleteActionCache.getProcessList()) {
            Property property2=process.getProperty();
            boolean isDelete=factory.getStatus(process) == ERepositoryStatus.DELETED;
            Item item2=property2.getItem();
            if (item == item2) {
              continue;
            }
            if (!isOpenedItem(item2,deleteActionCache.getOpenProcessMap())) {
              if (item2 instanceof ProcessItem) {
                nodesList=((ProcessItem)item2).getProcess().getNode();
              }
            }
            if (nodesList != null) {
              for (              Object object2 : nodesList) {
                if (object2 instanceof NodeType) {
                  NodeType nodeType=(NodeType)object2;
                  boolean equals=false;
                  if ("String_Node_Str".equals(nodeType.getComponentName())) {
                    boolean isUseDynamicJob=false;
                    for (                    Object obj : nodeType.getElementParameter()) {
                      if (obj != null && obj instanceof ElementParameterType) {
                        ElementParameterType param=(ElementParameterType)obj;
                        if (USE_DYNAMIC_JOB.equals(param.getName())) {
                          isUseDynamicJob=Boolean.parseBoolean(param.getValue());
                        }
                        if ("String_Node_Str".equals(param.getName())) {
                          if (isUseDynamicJob) {
                            String[] jobIDs=param.getValue().split("String_Node_Str");
                            for (                            String jobID : jobIDs) {
                              if (property.getId().equals(jobID)) {
                                equals=true;
                                break;
                              }
                            }
                          }
 else                           if (property.getId().equals(param.getValue())) {
                            equals=true;
                          }
                        }
                      }
                    }
                  }
                  if (equals) {
                    String path=item2.getState().getPath();
                    boolean found=false;
                    ItemReferenceBean bean=new ItemReferenceBean();
                    bean.setItemName(label);
                    bean.setItemVersion(version);
                    bean.setItemType(type);
                    bean.setItemDeleted(isItemDeleted);
                    bean.setReferenceItemName(property2.getLabel());
                    bean.setReferenceItemVersion(property2.getVersion());
                    bean.setReferenceItemType(process.getRepositoryObjectType());
                    bean.setReferenceItemPath(path);
                    bean.setReferenceProjectName(refP.getLabel());
                    bean.setReferenceItemDeleted(isDelete);
                    for (                    ItemReferenceBean b : list) {
                      if (b.equals(bean)) {
                        found=true;
                        b.addNodeNum();
                        break;
                      }
                    }
                    if (!found) {
                      list.add(bean);
                    }
                  }
                }
              }
            }
          }
          for (          IProcess2 openedProcess : deleteActionCache.getOpenedProcessList()) {
            for (            INode node : openedProcess.getGraphicalNodes()) {
              boolean equals=false;
              IElementParameter processTypeParam=node.getElementParameter(PROCESS_TYPE_PROCESS);
              if (processTypeParam != null) {
                IElementParameter isUseDynamicJob=node.getElementParameter(USE_DYNAMIC_JOB);
                if (isUseDynamicJob != null && (Boolean)isUseDynamicJob.getValue()) {
                  String[] jobsID=((String)processTypeParam.getValue()).split("String_Node_Str");
                  for (                  String jobID : jobsID) {
                    if (property.getId().equals(jobID)) {
                      equals=true;
                      break;
                    }
                  }
                }
 else                 if (property.getId().equals(processTypeParam.getValue())) {
                  equals=true;
                }
              }
              boolean isDelete=factory.getStatus(openedProcess) == ERepositoryStatus.DELETED;
              Property property2=openedProcess.getProperty();
              Item item2=property2.getItem();
              String path=item2.getState().getPath();
              if (equals) {
                boolean found=false;
                ItemReferenceBean bean=new ItemReferenceBean();
                bean.setItemName(label);
                bean.setItemVersion(version);
                bean.setItemType(type);
                bean.setItemDeleted(isItemDeleted);
                bean.setReferenceItemName(property2.getLabel());
                bean.setReferenceItemVersion(property2.getVersion());
                bean.setReferenceItemType(ERepositoryObjectType.getItemType(item2));
                bean.setReferenceItemPath(path);
                bean.setReferenceProjectName(refP.getLabel());
                bean.setReferenceItemDeleted(isDelete);
                for (                ItemReferenceBean b : list) {
                  if (b.equals(bean)) {
                    found=true;
                    b.addNodeNum();
                    break;
                  }
                }
                if (!found) {
                  list.add(bean);
                }
              }
            }
          }
        }
      }
 catch (      PersistenceException e) {
        ExceptionHandler.process(e);
      }
    }
  }
  Iterator<ItemReferenceBean> it=list.iterator();
  while (it.hasNext()) {
    ItemReferenceBean bean=it.next();
    if ((!bean.isItemDeleted() && bean.isReferenceItemDeleted()) || (bean.isItemDeleted() && bean.isReferenceItemDeleted() && isItemInDeleteList(bean,true)) || (!bean.isItemDeleted() && !bean.isReferenceItemDeleted() && isItemInDeleteList(bean,true))) {
      it.remove();
    }
  }
  return list;
}