Program: 32313
Project: 32313
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,List<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,List<Long>>> contentFuture=pool.submit(new CategoryProcessor(graphDb,root,category.getValue()));
    contentsFutures.add(contentFuture);
  }
  Map<String,List<Long>> toTag=new HashMap<String,List<Long>>();
  for (  Future<Map<String,List<Long>>> contentFuture : contentsFutures) {
    final Map<String,List<Long>> resolved=contentFuture.get();
    toTag.putAll(resolved);
  }
  pool.shutdown();
  pool.awaitTermination(10,TimeUnit.DAYS);
  tx.success();
  tx.close();
  tx=graphDb.beginTx();
  for (  Entry<String,List<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<>();
    int partitionSize=1000;
    List<List<Long>> partitions=new LinkedList<List<Long>>();
    for (int i=0; i < t.getValue().size(); i+=partitionSize) {
      partitions.add(t.getValue().subList(i,Math.min(i + partitionSize,t.getValue().size())));
    }
    for (    List<Long> ids : partitions) {
      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,List<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,List<Long>>> contentFuture=pool.submit(new CategoryProcessor(graphDb,root,category.getValue()));
    contentsFutures.add(contentFuture);
  }
  Map<String,List<Long>> toTag=new HashMap<String,List<Long>>();
  for (  Future<Map<String,List<Long>>> contentFuture : contentsFutures) {
    final Map<String,List<Long>> resolved=contentFuture.get();
    String key=resolved.keySet().iterator().next();
    if (toTag.containsKey(key)) {
      List<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,List<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<>();
    int partitionSize=1000;
    List<List<Long>> partitions=new LinkedList<List<Long>>();
    for (int i=0; i < t.getValue().size(); i+=partitionSize) {
      partitions.add(t.getValue().subList(i,Math.min(i + partitionSize,t.getValue().size())));
    }
    for (    List<Long> ids : partitions) {
      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();
}