Program: 96466
Project: 96466
Buggy source:
private Set<IBundle> addOutgoingServiceDependencies(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 (outgoingDependencyDegree >= degree) {
    for (    IServiceReference pe : bundle.getServicesInUse()) {
      IBundle dependantBundle=this.bundles.get(pe.getBundleId());
      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(dependantBundle,bundle);
        bundleDependencies.add(bundleDependency);
        dependencies.add(bundleDependency);
      }
      contentResult.addOutgoingDependency(degree,dependantBundle);
      bundleDependency.addServiceReferece(pe);
      dependentBundles.add(dependantBundle);
    }
  }
  if (outgoingDependencyDegree > degree) {
    return dependentBundles;
  }
  return Collections.emptySet();
}

Fixed version (ground truth):
private Set<IBundle> addOutgoingServiceDependencies(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 (outgoingDependencyDegree >= degree) {
    for (    IServiceReference pe : bundle.getServicesInUse()) {
      IBundle dependantBundle=this.bundles.get(pe.getBundleId());
      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(dependantBundle,bundle);
        bundleDependencies.add(bundleDependency);
        dependencies.add(bundleDependency);
      }
      contentResult.addOutgoingDependency(Integer.valueOf(degree),dependantBundle);
      bundleDependency.addServiceReferece(pe);
      dependentBundles.add(dependantBundle);
    }
  }
  if (outgoingDependencyDegree > degree) {
    return dependentBundles;
  }
  return Collections.emptySet();
}