Program: 110657
Project: 110657
Buggy source:
@Override public Iterable<PathFragment> getPackagesUnderDirectory(ExtendedEventHandler eventHandler,RepositoryName repository,PathFragment directory,ImmutableSet<PathFragment> blacklistedSubdirectories,ImmutableSet<PathFragment> excludedSubdirectories) throws MissingDepException, InterruptedException {
  PathPackageLocator packageLocator=PrecomputedValue.PATH_PACKAGE_LOCATOR.get(env);
  if (packageLocator == null) {
    throw new MissingDepException();
  }
  List<Path> roots=new ArrayList<>();
  if (repository.isMain()) {
    roots.addAll(packageLocator.getPathEntries());
  }
 else {
    RepositoryDirectoryValue repositoryValue=(RepositoryDirectoryValue)env.getValue(RepositoryDirectoryValue.key(repository));
    if (repositoryValue == null) {
      throw new MissingDepException();
    }
    if (!repositoryValue.repositoryExists()) {
      throw new IllegalStateException(String.format("String_Node_Str",repository));
    }
    roots.add(repositoryValue.getPath());
  }
  LinkedHashSet<PathFragment> packageNames=new LinkedHashSet<>();
  for (  Path root : roots) {
    PathFragment.checkAllPathsAreUnder(blacklistedSubdirectories,directory);
    RecursivePkgValue lookup=(RecursivePkgValue)env.getValue(RecursivePkgValue.key(repository,RootedPath.toRootedPath(root,directory),blacklistedSubdirectories));
    if (lookup == null) {
      throw new MissingDepException();
    }
    for (    String packageName : lookup.getPackages()) {
      PathFragment packageNamePathFragment=PathFragment.create(packageName);
      if (!Iterables.any(excludedSubdirectories,excludedSubdirectory -> packageNamePathFragment.startsWith(excludedSubdirectory))) {
        packageNames.add(packageNamePathFragment);
      }
    }
  }
  return packageNames;
}

Fixed version (ground truth):
@Override public Iterable<PathFragment> getPackagesUnderDirectory(ExtendedEventHandler eventHandler,RepositoryName repository,PathFragment directory,ImmutableSet<PathFragment> blacklistedSubdirectories,ImmutableSet<PathFragment> excludedSubdirectories) throws MissingDepException, InterruptedException {
  PathPackageLocator packageLocator=PrecomputedValue.PATH_PACKAGE_LOCATOR.get(env);
  if (packageLocator == null) {
    throw new MissingDepException();
  }
  List<Path> roots=new ArrayList<>();
  if (repository.isMain()) {
    roots.addAll(packageLocator.getPathEntries());
  }
 else {
    RepositoryDirectoryValue repositoryValue=(RepositoryDirectoryValue)env.getValue(RepositoryDirectoryValue.key(repository));
    if (repositoryValue == null) {
      throw new MissingDepException();
    }
    if (!repositoryValue.repositoryExists()) {
      throw new IllegalStateException(String.format("String_Node_Str",repository));
    }
    roots.add(repositoryValue.getPath());
  }
  if (blacklistedSubdirectories.contains(directory)) {
    return ImmutableList.of();
  }
  PathFragment.checkAllPathsAreUnder(blacklistedSubdirectories,directory);
  LinkedHashSet<PathFragment> packageNames=new LinkedHashSet<>();
  for (  Path root : roots) {
    RecursivePkgValue lookup=(RecursivePkgValue)env.getValue(RecursivePkgValue.key(repository,RootedPath.toRootedPath(root,directory),blacklistedSubdirectories));
    if (lookup == null) {
      throw new MissingDepException();
    }
    for (    String packageName : lookup.getPackages()) {
      PathFragment packageNamePathFragment=PathFragment.create(packageName);
      if (!Iterables.any(excludedSubdirectories,excludedSubdirectory -> packageNamePathFragment.startsWith(excludedSubdirectory))) {
        packageNames.add(packageNamePathFragment);
      }
    }
  }
  return packageNames;
}