Program: 125542
Project: 125542
Buggy source:
@Override protected void checkAndSetParameters(IProcess2 process2){
  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 (getColumnRenamedMap() != null && !getColumnRenamedMap().isEmpty()) {
      manager.setColumnRenamedMap(getColumnRenamedMap());
    }
    if (getDeletedOrReselectTablesMap() != null && !getDeletedOrReselectTablesMap().isEmpty()) {
      manager.setDeletedOrReselectTablesMap(getDeletedOrReselectTablesMap());
    }
    manager.setFromRepository(true);
    if (isAddColumn) {
      manager.setAddColumn(true);
      isAddColumn=false;
    }
  }
}

Fixed version (ground truth):
@Override protected void checkAndSetParameters(IProcess2 process2){
  IContextManager contextManager=process2.getContextManager();
  if (contextManager instanceof JobContextManager) {
    JobContextManager jobContextManager=(JobContextManager)contextManager;
    jobContextManager.setRepositoryRenamedMap(getContextRenamedMap());
    jobContextManager.setNewParametersMap(getNewParametersMap());
    Map<ContextItem,List<IContext>> repositoryAddGroupContext=getRepositoryAddGroupContext();
    if (checkAddContextGroup && repositoryAddGroupContext.isEmpty() && parameter instanceof ContextItem) {
      List<IContext> addContextGroupList=new ArrayList<IContext>();
      List<IContext> jobContexts=process2.getContextManager().getListContext();
      List<ContextType> repositoryContexts=((ContextItem)parameter).getContext();
      String repositoryId=((ContextItem)parameter).getProperty().getId();
      for (      ContextType repoContext : repositoryContexts) {
        boolean found=false;
        for (        IContext jobContext : jobContexts) {
          if (jobContext.getName().equals(repoContext.getName())) {
            found=true;
          }
        }
        if (!found) {
          IContext jobContext=new JobContext(repoContext.getName());
          List<ContextParameterType> repoParams=repoContext.getContextParameter();
          for (          ContextParameterType repoParam : repoParams) {
            IContextParameter jobParam=new JobContextParameter();
            jobParam.setName(repoParam.getName());
            jobParam.setContext(jobContext);
            jobParam.setComment(repoParam.getComment());
            jobParam.setPrompt(repoParam.getPrompt());
            jobParam.setSource(repositoryId);
            jobParam.setType(repoParam.getType());
            jobParam.setValue(repoParam.getValue());
            jobContext.getContextParameterList().add(jobParam);
          }
          addContextGroupList.add(jobContext);
        }
      }
      repositoryAddGroupContext.put((ContextItem)parameter,addContextGroupList);
    }
    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 (getColumnRenamedMap() != null && !getColumnRenamedMap().isEmpty()) {
      manager.setColumnRenamedMap(getColumnRenamedMap());
    }
    if (getDeletedOrReselectTablesMap() != null && !getDeletedOrReselectTablesMap().isEmpty()) {
      manager.setDeletedOrReselectTablesMap(getDeletedOrReselectTablesMap());
    }
    manager.setFromRepository(true);
    if (isAddColumn) {
      manager.setAddColumn(true);
      isAddColumn=false;
    }
  }
}