Program: 126294
Project: 126294
Buggy source:
public void updateDependencies(IFile pomFile,IProgressMonitor progressMonitor) throws ProcessorException {
  try {
    MavenModelManager mavenModelManager=MavenPlugin.getMavenModelManager();
    Model model=mavenModelManager.readMavenModel(pomFile);
    List<Dependency> dependencies=model.getDependencies();
    if (dependencies == null) {
      dependencies=new ArrayList<Dependency>();
      model.setDependencies(dependencies);
    }
    List<String> oldDependencyIds=new ArrayList<String>();
    for (    Dependency dependency : dependencies) {
      oldDependencyIds.add(dependency.getArtifactId());
    }
    dependencies.clear();
    List<String> newDependencyIds=new ArrayList<String>();
    Dependency junitDependency=new Dependency();
    final Model junitModel=TalendCodeProjectUtil.getJunitTempalteModel();
    junitDependency.setVersion(junitModel.getVersion());
    junitDependency.setGroupId(junitModel.getGroupId());
    junitDependency.setArtifactId(junitModel.getArtifactId());
    junitDependency.setScope(TalendMavenContants.DEFAULT_JUNIT_ARTIFACT_SCOPE);
    dependencies.add(junitDependency);
    newDependencyIds.add(junitDependency.getArtifactId());
    Set<String> neededLibraries=processor.getNeededLibraries();
    for (    String lib : neededLibraries) {
      String name=new Path(lib).removeFileExtension().toString();
      Dependency dependency=new Dependency();
      String group=name;
      String artifact=name;
      String version=TalendMavenContants.DEFAULT_VERSION;
      if (TalendCodeProjectUtil.stripVersion) {
      }
      dependency.setGroupId(group);
      dependency.setArtifactId(artifact);
      dependency.setVersion(version);
      dependency.setScope("String_Node_Str");
      dependency.setSystemPath("String_Node_Str" + lib);
      dependencies.add(dependency);
      newDependencyIds.add(dependency.getArtifactId());
    }
    final Set<JobInfo> clonedChildrenJobInfors=getClonedJobInfos();
    for (    JobInfo child : clonedChildrenJobInfors) {
      Dependency dependency=new Dependency();
      final String childJobName=JavaResourcesHelper.escapeFileName(child.getJobName());
      String artifact=childJobName;
      if (TalendCodeProjectUtil.stripVersion) {
        artifact=JavaResourcesHelper.getJobJarName(childJobName,child.getJobVersion());
      }
      dependency.setGroupId(generateGroupId(child));
      dependency.setArtifactId(artifact);
      dependency.setVersion(child.getJobVersion());
      dependencies.add(dependency);
      newDependencyIds.add(dependency.getArtifactId());
    }
    boolean changed=oldDependencyIds.retainAll(newDependencyIds);
    if (!changed) {
      changed=newDependencyIds.retainAll(oldDependencyIds);
    }
    if (changed) {
      PomManager.savePom(progressMonitor,model,pomFile);
    }
  }
 catch (  Exception e) {
    throw new ProcessorException(e);
  }
}

Fixed version (ground truth):
public void updateDependencies(IFile pomFile,IProgressMonitor progressMonitor) throws ProcessorException {
  try {
    MavenModelManager mavenModelManager=MavenPlugin.getMavenModelManager();
    Model model=mavenModelManager.readMavenModel(pomFile);
    List<Dependency> dependencies=model.getDependencies();
    if (dependencies == null) {
      dependencies=new ArrayList<Dependency>();
      model.setDependencies(dependencies);
    }
    List<String> oldDependencyIds=new ArrayList<String>();
    for (    Dependency dependency : dependencies) {
      oldDependencyIds.add(dependency.getArtifactId());
    }
    dependencies.clear();
    List<String> newDependencyIds=new ArrayList<String>();
    Set<String> neededLibraries=processor.getNeededLibraries();
    for (    String lib : neededLibraries) {
      String name=new Path(lib).removeFileExtension().toString();
      Dependency dependency=new Dependency();
      String group=name;
      String artifact=name;
      String version=TalendMavenContants.DEFAULT_VERSION;
      if (TalendCodeProjectUtil.stripVersion) {
      }
      dependency.setGroupId(group);
      dependency.setArtifactId(artifact);
      dependency.setVersion(version);
      dependency.setScope("String_Node_Str");
      dependency.setSystemPath("String_Node_Str" + lib);
      dependencies.add(dependency);
      newDependencyIds.add(dependency.getArtifactId());
    }
    final Set<JobInfo> clonedChildrenJobInfors=getClonedJobInfos();
    for (    JobInfo child : clonedChildrenJobInfors) {
      Dependency dependency=new Dependency();
      final String childJobName=JavaResourcesHelper.escapeFileName(child.getJobName());
      String artifact=childJobName;
      if (TalendCodeProjectUtil.stripVersion) {
        artifact=JavaResourcesHelper.getJobJarName(childJobName,child.getJobVersion());
      }
      dependency.setGroupId(generateGroupId(child));
      dependency.setArtifactId(artifact);
      dependency.setVersion(child.getJobVersion());
      dependencies.add(dependency);
      newDependencyIds.add(dependency.getArtifactId());
    }
    boolean changed=oldDependencyIds.retainAll(newDependencyIds);
    if (!changed) {
      changed=newDependencyIds.retainAll(oldDependencyIds);
    }
    if (changed) {
      PomManager.savePom(progressMonitor,model,pomFile);
    }
  }
 catch (  Exception e) {
    throw new ProcessorException(e);
  }
}