Program: 32315
Project: 32315
Buggy source:
public void processCategories(Map<String,String> categories) throws InterruptedException, ExecutionException {
  logger.info("String_Node_Str");
  final ExecutorService pool=Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
  List<Future<Map<String,Set<Long>>>> contentsFutures=new ArrayList<>();
  Transaction tx=graphDb.beginTx();
  for (  Entry<String,String> category : categories.entrySet()) {
    ReadableIndex<Node> nodeIndex=graphDb.index().getNodeAutoIndexer().getAutoIndex();
    Node root=nodeIndex.get(CommonProperties.IRI,category.getKey()).getSingle();
    final Future<Map<String,Set<Long>>> contentFuture=pool.submit(new CategoryProcessor(graphDb,root,category.getValue()));
    contentsFutures.add(contentFuture);
  }
  Map<String,Set<Long>> toTag=new HashMap<String,Set<Long>>();
  for (  Future<Map<String,Set<Long>>> contentFuture : contentsFutures) {
    final Map<String,Set<Long>> resolved=contentFuture.get();
    String key=resolved.keySet().iterator().next();
    if (toTag.containsKey(key)) {
      Set<Long> acc=toTag.get(key);
      acc.addAll(resolved.get(key));
      toTag.put(key,acc);
    }
 else {
      toTag.putAll(resolved);
    }
  }
  pool.shutdown();
  pool.awaitTermination(10,TimeUnit.DAYS);
  tx.success();
  tx.close();
  tx=graphDb.beginTx();
  for (  Entry<String,Set<Long>> t : toTag.entrySet()) {
    String category=t.getKey();
    logger.info("String_Node_Str" + t.getValue().size() + "String_Node_Str"+ category);
    final ExecutorService taggingPool=Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
    List<Future<Boolean>> taggedFutures=new ArrayList<>();
    for (    List<Long> ids : Iterables.partition(t.getValue(),1000)) {
      final Future<Boolean> contentFuture=taggingPool.submit(new CategoryLabeler(graphDb,ids,category));
      taggedFutures.add(contentFuture);
    }
    for (    Future<Boolean> taggedFuture : taggedFutures) {
      taggedFuture.get();
    }
    taggingPool.shutdown();
    taggingPool.awaitTermination(10,TimeUnit.DAYS);
  }
  tx.success();
  tx.close();
}

Fixed version (ground truth):
public void processCategories(Map<String,String> categories) throws InterruptedException, ExecutionException {
  logger.info("String_Node_Str");
  final ExecutorService pool=Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
  List<Future<Map<String,Set<Long>>>> contentsFutures=new ArrayList<>();
  Transaction tx=graphDb.beginTx();
  for (  Entry<String,String> category : categories.entrySet()) {
    ReadableIndex<Node> nodeIndex=graphDb.index().getNodeAutoIndexer().getAutoIndex();
    Node root=nodeIndex.get(CommonProperties.IRI,category.getKey()).getSingle();
    final Future<Map<String,Set<Long>>> contentFuture=pool.submit(new CategoryProcessor(graphDb,root,category.getValue()));
    contentsFutures.add(contentFuture);
  }
  Map<String,Set<Long>> toTag=new HashMap<String,Set<Long>>();
  for (  Future<Map<String,Set<Long>>> contentFuture : contentsFutures) {
    final Map<String,Set<Long>> resolved=contentFuture.get();
    Iterator<String> iter=resolved.keySet().iterator();
    if (iter.hasNext()) {
      String key=resolved.keySet().iterator().next();
      if (toTag.containsKey(key)) {
        Set<Long> acc=toTag.get(key);
        acc.addAll(resolved.get(key));
        toTag.put(key,acc);
      }
 else {
        toTag.putAll(resolved);
      }
    }
  }
  pool.shutdown();
  pool.awaitTermination(10,TimeUnit.DAYS);
  tx.success();
  tx.close();
  tx=graphDb.beginTx();
  for (  Entry<String,Set<Long>> t : toTag.entrySet()) {
    String category=t.getKey();
    logger.info("String_Node_Str" + t.getValue().size() + "String_Node_Str"+ category);
    final ExecutorService taggingPool=Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
    List<Future<Boolean>> taggedFutures=new ArrayList<>();
    for (    List<Long> ids : Iterables.partition(t.getValue(),1000)) {
      final Future<Boolean> contentFuture=taggingPool.submit(new CategoryLabeler(graphDb,ids,category));
      taggedFutures.add(contentFuture);
    }
    for (    Future<Boolean> taggedFuture : taggedFutures) {
      taggedFuture.get();
    }
    taggingPool.shutdown();
    taggingPool.awaitTermination(10,TimeUnit.DAYS);
  }
  tx.success();
  tx.close();
}