Program: 110659
Project: 110659
Buggy source:
@Override public <E extends Exception>void findTargetsBeneathDirectory(RepositoryName repository,String originalPattern,String directory,boolean rulesOnly,ImmutableSet<PathFragment> blacklistedSubdirectories,ImmutableSet<PathFragment> excludedSubdirectories,BatchCallback<Void,E> callback,Class<E> exceptionClass) throws TargetParsingException, E, InterruptedException {
  Preconditions.checkArgument(excludedSubdirectories.isEmpty(),excludedSubdirectories);
  FilteringPolicy policy=rulesOnly ? FilteringPolicies.RULES_ONLY : FilteringPolicies.NO_FILTER;
  PathFragment pathFragment=TargetPatternResolverUtil.getPathFragment(directory);
  List<Path> roots=new ArrayList<>();
  if (repository.isMain()) {
    roots.addAll(pkgPath.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());
  }
  for (  Path root : roots) {
    RootedPath rootedPath=RootedPath.toRootedPath(root,pathFragment);
    env.getValues(ImmutableList.of(PrepareDepsOfTargetsUnderDirectoryValue.key(repository,rootedPath,blacklistedSubdirectories,policy),CollectPackagesUnderDirectoryValue.key(repository,rootedPath,blacklistedSubdirectories)));
    if (env.valuesMissing()) {
      throw new MissingDepException();
    }
  }
}

Fixed version (ground truth):
@Override public <E extends Exception>void findTargetsBeneathDirectory(RepositoryName repository,String originalPattern,String directory,boolean rulesOnly,ImmutableSet<PathFragment> blacklistedSubdirectories,ImmutableSet<PathFragment> excludedSubdirectories,BatchCallback<Void,E> callback,Class<E> exceptionClass) throws TargetParsingException, E, InterruptedException {
  PathFragment directoryPathFragment=TargetPatternResolverUtil.getPathFragment(directory);
  if (blacklistedSubdirectories.contains(directoryPathFragment)) {
    return;
  }
  Preconditions.checkArgument(excludedSubdirectories.isEmpty(),excludedSubdirectories);
  FilteringPolicy policy=rulesOnly ? FilteringPolicies.RULES_ONLY : FilteringPolicies.NO_FILTER;
  List<Path> roots=new ArrayList<>();
  if (repository.isMain()) {
    roots.addAll(pkgPath.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());
  }
  for (  Path root : roots) {
    RootedPath rootedPath=RootedPath.toRootedPath(root,directoryPathFragment);
    env.getValues(ImmutableList.of(PrepareDepsOfTargetsUnderDirectoryValue.key(repository,rootedPath,blacklistedSubdirectories,policy),CollectPackagesUnderDirectoryValue.key(repository,rootedPath,blacklistedSubdirectories)));
    if (env.valuesMissing()) {
      throw new MissingDepException();
    }
  }
}