Program: 96463
Project: 96463
Buggy source:
private Set<IBundle> addIncomingServiceDependencies(Set<BundleDependency> dependencies,IBundle bundle,int degree,Set<IBundle> processedBundles){
  if (processedBundles.contains(bundle)) {
    return Collections.emptySet();
  }
  processedBundles.add(bundle);
  Set<IBundle> dependentBundles=new HashSet<IBundle>();
  if (incomingDependencyDegree >= degree) {
    for (    IServiceReference pe : bundle.getRegisteredServices()) {
      for (      Long id : pe.getUsingBundleIds()) {
        IBundle dependantBundle=this.bundles.get(id);
        Set<BundleDependency> bundleDependencies=null;
        if (dependenciesByBundle.containsKey(bundle)) {
          bundleDependencies=dependenciesByBundle.get(bundle);
        }
 else {
          bundleDependencies=new HashSet<BundleDependency>();
          dependenciesByBundle.put(bundle,bundleDependencies);
        }
        ServiceReferenceBundleDependency bundleDependency=null;
        for (        BundleDependency dep : bundleDependencies) {
          if (dep.getExportingBundle().equals(dependantBundle) && dep instanceof ServiceReferenceBundleDependency) {
            bundleDependency=(ServiceReferenceBundleDependency)dep;
            break;
          }
        }
        if (bundleDependency == null) {
          bundleDependency=new ServiceReferenceBundleDependency(bundle,dependantBundle);
          bundleDependencies.add(bundleDependency);
          dependencies.add(bundleDependency);
        }
        contentResult.addIncomingDependency(degree,dependantBundle);
        bundleDependency.addServiceReferece(pe);
        dependentBundles.add(dependantBundle);
      }
    }
  }
  if (incomingDependencyDegree > degree) {
    return dependentBundles;
  }
  return Collections.emptySet();
}

Fixed version (ground truth):
private Set<IBundle> addIncomingServiceDependencies(Set<BundleDependency> dependencies,IBundle bundle,int degree,Set<IBundle> processedBundles){
  if (processedBundles.contains(bundle)) {
    return Collections.emptySet();
  }
  processedBundles.add(bundle);
  Set<IBundle> dependentBundles=new HashSet<IBundle>();
  if (incomingDependencyDegree >= degree) {
    for (    IServiceReference pe : bundle.getRegisteredServices()) {
      for (      Long id : pe.getUsingBundleIds()) {
        IBundle dependantBundle=this.bundles.get(id);
        Set<BundleDependency> bundleDependencies=null;
        if (dependenciesByBundle.containsKey(bundle)) {
          bundleDependencies=dependenciesByBundle.get(bundle);
        }
 else {
          bundleDependencies=new HashSet<BundleDependency>();
          dependenciesByBundle.put(bundle,bundleDependencies);
        }
        ServiceReferenceBundleDependency bundleDependency=null;
        for (        BundleDependency dep : bundleDependencies) {
          if (dep.getExportingBundle().equals(dependantBundle) && dep instanceof ServiceReferenceBundleDependency) {
            bundleDependency=(ServiceReferenceBundleDependency)dep;
            break;
          }
        }
        if (bundleDependency == null) {
          bundleDependency=new ServiceReferenceBundleDependency(bundle,dependantBundle);
          bundleDependencies.add(bundleDependency);
          dependencies.add(bundleDependency);
        }
        contentResult.addIncomingDependency(Integer.valueOf(degree),dependantBundle);
        bundleDependency.addServiceReferece(pe);
        dependentBundles.add(dependantBundle);
      }
    }
  }
  if (incomingDependencyDegree > degree) {
    return dependentBundles;
  }
  return Collections.emptySet();
}