Program: 126266
Project: 126266
Buggy source:
/** 
 * DOC ggu Comment method "updateDependencies". add the job Needed Libraries for current model.
 * @param model the job of pom model
 * @param fresh if true, will remove old dependencies, else will add the new dependencies in the head.
 * @return if there are some changes, will return true
 */
public boolean updateDependencies(IProgressMonitor progressMonitor,Model model,List<Dependency> neededDependencies,boolean fresh) throws ProcessorException {
  boolean changed=false;
  try {
    List<Dependency> existedDependencies=model.getDependencies();
    if (existedDependencies == null) {
      existedDependencies=new ArrayList<Dependency>();
      model.setDependencies(existedDependencies);
    }
    existedDependencies.clear();
    Map<String,Dependency> existedDependenciesMap=new LinkedHashMap<String,Dependency>();
    if (!fresh) {
      for (      Dependency dependency : existedDependencies) {
        if (!PomUtil.isAvailable(dependency)) {
          continue;
        }
        existedDependenciesMap.put(PomUtil.generateMvnUrl(dependency),dependency);
      }
    }
    for (    Dependency dependency : neededDependencies) {
      Dependency cloneDependency=dependency.clone();
      existedDependencies.add(cloneDependency);
      if (fresh) {
        changed=true;
      }
 else {
        String mvnUrl=PomUtil.generateMvnUrl(dependency);
        Dependency existedDependency=existedDependenciesMap.remove(mvnUrl);
        if (existedDependency != null) {
        }
 else {
          changed=true;
        }
      }
    }
    if (!fresh) {
      existedDependencies.addAll(existedDependenciesMap.values());
    }
  }
 catch (  Exception e) {
    throw new ProcessorException(e);
  }
  return changed;
}

Fixed version (ground truth):
/** 
 * DOC ggu Comment method "updateDependencies". add the job Needed Libraries for current model.
 * @param model the job of pom model
 * @param fresh if true, will remove old dependencies, else will add the new dependencies in the head.
 * @return if there are some changes, will return true
 */
public boolean updateDependencies(IProgressMonitor progressMonitor,Model model,List<Dependency> neededDependencies,boolean fresh) throws ProcessorException {
  boolean changed=false;
  try {
    List<Dependency> existedDependencies=model.getDependencies();
    if (existedDependencies == null) {
      existedDependencies=new ArrayList<Dependency>();
      model.setDependencies(existedDependencies);
    }
    Map<String,Dependency> existedDependenciesMap=new LinkedHashMap<String,Dependency>();
    if (!fresh) {
      for (      Dependency dependency : existedDependencies) {
        if (!PomUtil.isAvailable(dependency)) {
          continue;
        }
        existedDependenciesMap.put(PomUtil.generateMvnUrl(dependency),dependency);
      }
    }
    existedDependencies.clear();
    for (    Dependency dependency : neededDependencies) {
      Dependency cloneDependency=dependency.clone();
      existedDependencies.add(cloneDependency);
      if (fresh) {
        changed=true;
      }
 else {
        String mvnUrl=PomUtil.generateMvnUrl(dependency);
        Dependency existedDependency=existedDependenciesMap.remove(mvnUrl);
        if (existedDependency != null) {
        }
 else {
          changed=true;
        }
      }
    }
    if (!fresh) {
      existedDependencies.addAll(existedDependenciesMap.values());
    }
  }
 catch (  Exception e) {
    throw new ProcessorException(e);
  }
  return changed;
}