Program: 128030
Project: 128030
Buggy source:
protected List<UpdateResult> getResultFromProcess(IProcess process,final Set<EUpdateItemType> types,final boolean onlySimpleShow){
  if (process == null || types == null) {
    return null;
  }
  List<UpdateResult> resultList=new ArrayList<UpdateResult>();
  if (process instanceof IProcess2) {
    IProcess2 process2=(IProcess2)process;
    IContextManager contextManager=process2.getContextManager();
    if (contextManager instanceof JobContextManager) {
      JobContextManager jobContextManager=(JobContextManager)contextManager;
      jobContextManager.setRepositoryRenamedMap(getContextRenamedMap());
      jobContextManager.setNewParametersMap(getNewParametersMap());
      Map<ContextItem,List<IContext>> repositoryAddGroupContext=getRepositoryAddGroupContext();
      List<IContext> listIContext=new ArrayList<IContext>();
      for (      ContextItem item : repositoryAddGroupContext.keySet()) {
        List<IContext> list=repositoryAddGroupContext.get(item);
        ListIterator<IContext> listIterator=list.listIterator();
        while (listIterator.hasNext()) {
          IContext context=listIterator.next();
          JobContext newJobContext=new JobContext(context.getName());
          List<IContextParameter> existedParameters=new ArrayList<IContextParameter>();
          for (int j=0; j < context.getContextParameterList().size(); j++) {
            IContextParameter param=context.getContextParameterList().get(j);
            IContextParameter contextParameter=jobContextManager.getDefaultContext().getContextParameter(param.getName());
            if (contextParameter != null && param.getName().equals(contextParameter.getName()) && item.getProperty().getId().equals(contextParameter.getSource())) {
              IContextParameter clone=param.clone();
              clone.setContext(newJobContext);
              existedParameters.add(clone);
            }
          }
          if (!existedParameters.isEmpty()) {
            newJobContext.setContextParameterList(existedParameters);
            listIContext.add(newJobContext);
          }
        }
      }
      jobContextManager.setAddGroupContext(listIContext);
      jobContextManager.setAddContextGroupMap(repositoryAddGroupContext);
      Map<ContextItem,List<IContext>> repositoryRemoveGroupContext=getRepositoryRemoveGroupContext();
      List<IContext> removeListIContext=new ArrayList<IContext>();
      for (      ContextItem item : repositoryRemoveGroupContext.keySet()) {
        List<IContext> list=repositoryRemoveGroupContext.get(item);
        ListIterator<IContext> listIterator=list.listIterator();
        while (listIterator.hasNext()) {
          IContext context=listIterator.next();
          if (!removeListIContext.contains(context)) {
            removeListIContext.add(context);
          }
        }
      }
      jobContextManager.setRemoveGroupContext(removeListIContext);
      jobContextManager.setRemoveContextGroupMap(repositoryRemoveGroupContext);
      Map<ContextItem,List<IContext>> repositoryRenameGroupContext=getRepositoryRenameGroupContext();
      jobContextManager.setRenameGroupContext(getRenameContextGroup());
      jobContextManager.setRenameContextGroupMap(repositoryRenameGroupContext);
    }
    IUpdateManager updateManager=process2.getUpdateManager();
    if (updateManager instanceof AbstractUpdateManager) {
      AbstractUpdateManager manager=(AbstractUpdateManager)updateManager;
      if (getSchemaRenamedMap() != null && !getSchemaRenamedMap().isEmpty()) {
        manager.setSchemaRenamedMap(getSchemaRenamedMap());
      }
      if (getDeletedOrReselectTablesMap() != null && !getDeletedOrReselectTablesMap().isEmpty()) {
        manager.setDeletedOrReselectTablesMap(getDeletedOrReselectTablesMap());
      }
      manager.setFromRepository(true);
    }
    for (    EUpdateItemType type : types) {
      List<UpdateResult> updatesNeeded=updateManager.getUpdatesNeeded(type,onlySimpleShow);
      if (updatesNeeded != null) {
        resultList.addAll(updatesNeeded);
      }
    }
    if (updateManager instanceof AbstractUpdateManager) {
      AbstractUpdateManager manager=(AbstractUpdateManager)updateManager;
      manager.setFromRepository(false);
    }
  }
  return resultList;
}

Fixed version (ground truth):
protected List<UpdateResult> getResultFromProcess(IProcess process,final Set<EUpdateItemType> types,final boolean onlySimpleShow){
  if (process == null || types == null) {
    return null;
  }
  List<UpdateResult> resultList=new ArrayList<UpdateResult>();
  if (process instanceof IProcess2) {
    IProcess2 process2=(IProcess2)process;
    IContextManager contextManager=process2.getContextManager();
    if (contextManager instanceof JobContextManager) {
      JobContextManager jobContextManager=(JobContextManager)contextManager;
      jobContextManager.setRepositoryRenamedMap(getContextRenamedMap());
      jobContextManager.setNewParametersMap(getNewParametersMap());
      Map<ContextItem,List<IContext>> repositoryAddGroupContext=getRepositoryAddGroupContext();
      List<IContext> listIContext=new ArrayList<IContext>();
      for (      ContextItem item : repositoryAddGroupContext.keySet()) {
        List<IContext> list=repositoryAddGroupContext.get(item);
        ListIterator<IContext> listIterator=list.listIterator();
        while (listIterator.hasNext()) {
          IContext context=listIterator.next();
          JobContext newJobContext=new JobContext(context.getName());
          List<IContextParameter> existedParameters=new ArrayList<IContextParameter>();
          for (int j=0; j < context.getContextParameterList().size(); j++) {
            IContextParameter param=context.getContextParameterList().get(j);
            IContextParameter contextParameter=jobContextManager.getDefaultContext().getContextParameter(param.getName());
            if (contextParameter != null && param.getName().equals(contextParameter.getName()) && item.getProperty().getId().equals(contextParameter.getSource())) {
              IContextParameter clone=param.clone();
              clone.setContext(newJobContext);
              existedParameters.add(clone);
            }
          }
          if (!existedParameters.isEmpty()) {
            newJobContext.setContextParameterList(existedParameters);
            listIContext.add(newJobContext);
          }
        }
      }
      jobContextManager.setAddGroupContext(listIContext);
      jobContextManager.setAddContextGroupMap(repositoryAddGroupContext);
      Map<ContextItem,List<IContext>> repositoryRemoveGroupContext=getRepositoryRemoveGroupContext();
      List<IContext> removeListIContext=new ArrayList<IContext>();
      for (      ContextItem item : repositoryRemoveGroupContext.keySet()) {
        List<IContext> list=repositoryRemoveGroupContext.get(item);
        ListIterator<IContext> listIterator=list.listIterator();
        while (listIterator.hasNext()) {
          IContext context=listIterator.next();
          if (!removeListIContext.contains(context)) {
            removeListIContext.add(context);
          }
        }
      }
      jobContextManager.setRemoveGroupContext(removeListIContext);
      jobContextManager.setRemoveContextGroupMap(repositoryRemoveGroupContext);
      Map<ContextItem,List<IContext>> repositoryRenameGroupContext=getRepositoryRenameGroupContext();
      jobContextManager.setRenameGroupContext(getRenameContextGroup());
      jobContextManager.setRenameContextGroupMap(repositoryRenameGroupContext);
    }
    IUpdateManager updateManager=process2.getUpdateManager();
    if (updateManager instanceof AbstractUpdateManager) {
      AbstractUpdateManager manager=(AbstractUpdateManager)updateManager;
      if (getSchemaRenamedMap() != null && !getSchemaRenamedMap().isEmpty()) {
        manager.setSchemaRenamedMap(getSchemaRenamedMap());
      }
      if (getDeletedOrReselectTablesMap() != null && !getDeletedOrReselectTablesMap().isEmpty()) {
        manager.setDeletedOrReselectTablesMap(getDeletedOrReselectTablesMap());
      }
      manager.setFromRepository(true);
      if (isAddColumn) {
        manager.setAddColumn(true);
        isAddColumn=false;
      }
    }
    for (    EUpdateItemType type : types) {
      List<UpdateResult> updatesNeeded=updateManager.getUpdatesNeeded(type,onlySimpleShow);
      if (updatesNeeded != null) {
        resultList.addAll(updatesNeeded);
      }
    }
    if (updateManager instanceof AbstractUpdateManager) {
      AbstractUpdateManager manager=(AbstractUpdateManager)updateManager;
      manager.setFromRepository(false);
    }
  }
  return resultList;
}