Program: 6861
Project: 6861
Buggy source:
@Override public void process(final ApplicationDeployable input) throws Exception {
  ImmutableList.Builder<Program> programs=ImmutableList.builder();
  final ApplicationSpecification appSpec=input.getSpecification();
  final String applicationName=appSpec.getName();
  final ArchiveBundler bundler=new ArchiveBundler(input.getLocation());
  Id.Namespace namespaceId=input.getId().getNamespace();
  Location namespacedLocation=namespacedLocationFactory.get(namespaceId);
  final Location appFabricDir=namespacedLocation.append(configuration.get(Constants.AppFabric.OUTPUT_DIR));
  if (!appFabricDir.exists() && !appFabricDir.mkdirs() && !appFabricDir.exists()) {
    throw new IOException(String.format("String_Node_Str",appFabricDir.toURI().getPath()));
  }
  Iterable<ProgramSpecification> specifications=Iterables.concat(appSpec.getMapReduce().values(),appSpec.getFlows().values(),appSpec.getWorkflows().values(),appSpec.getServices().values(),appSpec.getSpark().values(),appSpec.getWorkers().values());
  Set<String> servingHostNames=WebappProgramRunner.getServingHostNames(Locations.newInputSupplier(input.getLocation()));
  if (!servingHostNames.isEmpty()) {
    specifications=Iterables.concat(specifications,ImmutableList.of(createWebappSpec(ProgramType.WEBAPP.toString().toLowerCase())));
  }
  ListeningExecutorService executorService=MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(10,Threads.createDaemonThreadFactory("String_Node_Str")));
  try {
    List<ListenableFuture<Location>> futures=Lists.newArrayList();
    for (    final ProgramSpecification spec : specifications) {
      ListenableFuture<Location> future=executorService.submit(new Callable<Location>(){
        @Override public Location call() throws Exception {
          ProgramType type=ProgramTypes.fromSpecification(spec);
          String name=String.format(Locale.ENGLISH,"String_Node_Str",applicationName,type);
          Location programDir=appFabricDir.append(name);
          if (!programDir.exists()) {
            programDir.mkdirs();
          }
          Location output=programDir.append(String.format("String_Node_Str",spec.getName()));
          Id.Program programId=Id.Program.from(input.getId(),type,spec.getName());
          return ProgramBundle.create(programId,bundler,output,spec.getClassName(),appSpec);
        }
      }
);
      futures.add(future);
    }
    for (    Location jarLocation : Futures.allAsList(futures).get()) {
      programs.add(Programs.create(jarLocation,null));
    }
  }
  finally {
    executorService.shutdown();
  }
  Location newArchiveLocation=appFabricDir.append(applicationName).append(Constants.ARCHIVE_DIR);
  moveAppArchiveUnderAppDirectory(input.getLocation(),newArchiveLocation);
  ApplicationDeployable updatedAppDeployable=new ApplicationDeployable(input.getId(),input.getSpecification(),input.getExistingAppSpec(),input.getApplicationDeployScope(),newArchiveLocation);
  emit(new ApplicationWithPrograms(updatedAppDeployable,programs.build()));
}

Fixed version (ground truth):
@Override public void process(final ApplicationDeployable input) throws Exception {
  ImmutableList.Builder<Program> programs=ImmutableList.builder();
  final ApplicationSpecification appSpec=input.getSpecification();
  final String applicationName=appSpec.getName();
  final ArchiveBundler bundler=new ArchiveBundler(input.getLocation());
  Id.Namespace namespaceId=input.getId().getNamespace();
  Location namespacedLocation=namespacedLocationFactory.get(namespaceId);
  final Location appFabricDir=namespacedLocation.append(configuration.get(Constants.AppFabric.OUTPUT_DIR));
  if (!appFabricDir.exists() && !appFabricDir.mkdirs() && !appFabricDir.exists()) {
    throw new IOException(String.format("String_Node_Str",appFabricDir.toURI().getPath()));
  }
  Iterable<ProgramSpecification> specifications=Iterables.concat(appSpec.getMapReduce().values(),appSpec.getFlows().values(),appSpec.getWorkflows().values(),appSpec.getServices().values(),appSpec.getSpark().values(),appSpec.getWorkers().values());
  Set<String> servingHostNames=WebappProgramRunner.getServingHostNames(Locations.newInputSupplier(input.getLocation()));
  if (!servingHostNames.isEmpty()) {
    specifications=Iterables.concat(specifications,ImmutableList.of(createWebappSpec(ProgramType.WEBAPP.toString().toLowerCase())));
  }
  ListeningExecutorService executorService=MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(10,Threads.createDaemonThreadFactory("String_Node_Str")));
  try {
    List<ListenableFuture<Location>> futures=Lists.newArrayList();
    for (    final ProgramSpecification spec : specifications) {
      ListenableFuture<Location> future=executorService.submit(new Callable<Location>(){
        @Override public Location call() throws Exception {
          ProgramType type=ProgramTypes.fromSpecification(spec);
          String name=String.format(Locale.ENGLISH,"String_Node_Str",applicationName,type);
          Location programDir=appFabricDir.append(name);
          if (!programDir.exists()) {
            programDir.mkdirs();
          }
          Location output=programDir.append(String.format("String_Node_Str",spec.getName()));
          Id.Program programId=Id.Program.from(input.getId(),type,spec.getName());
          return ProgramBundle.create(programId,bundler,output,spec.getClassName(),appSpec);
        }
      }
);
      futures.add(future);
    }
    for (    Location jarLocation : Futures.allAsList(futures).get()) {
      programs.add(Programs.create(jarLocation,null));
    }
  }
  finally {
    executorService.shutdown();
  }
  Location newArchiveLocation=appFabricDir.append(applicationName).append(Constants.ARCHIVE_DIR);
  moveAppArchiveUnderAppDirectory(input.getLocation(),newArchiveLocation);
  Location programLocation=newArchiveLocation.append(input.getLocation().getName());
  ApplicationDeployable updatedAppDeployable=new ApplicationDeployable(input.getId(),input.getSpecification(),input.getExistingAppSpec(),input.getApplicationDeployScope(),programLocation);
  emit(new ApplicationWithPrograms(updatedAppDeployable,programs.build()));
}