Program: 52900
Project: 52900
Buggy source:
@Override public SRResult similarity(int pageId1,int pageId2,boolean explanations) throws DaoException {
  CategoryBfs bfs1=new CategoryBfs(graph,pageId1,getLanguage(),Integer.MAX_VALUE,null,catHelper);
  CategoryBfs bfs2=new CategoryBfs(graph,pageId2,getLanguage(),Integer.MAX_VALUE,null,catHelper);
  bfs1.setAddPages(false);
  bfs1.setExploreChildren(false);
  bfs2.setAddPages(false);
  bfs2.setExploreChildren(false);
  double shortestDistance=Double.POSITIVE_INFINITY;
  double maxDist1=0;
  double maxDist2=0;
  while ((bfs1.hasMoreResults() || bfs2.hasMoreResults()) && (maxDist1 + maxDist2 < shortestDistance)) {
    while (bfs1.hasMoreResults() && (maxDist1 <= maxDist2 || !bfs2.hasMoreResults())) {
      CategoryBfs.BfsVisited visited=bfs1.step();
      for (      int catId : visited.cats.keys()) {
        if (bfs2.hasCategoryDistance(catId)) {
          double d=bfs1.getCategoryDistance(catId) + bfs2.getCategoryDistance(catId) - graph.catCosts[catId];
          shortestDistance=Math.min(d,shortestDistance);
        }
      }
      maxDist1=Math.max(maxDist1,visited.maxCatDistance());
    }
    while (bfs2.hasMoreResults() && (maxDist2 <= maxDist1 || !bfs1.hasMoreResults())) {
      CategoryBfs.BfsVisited visited=bfs2.step();
      for (      int catId : visited.cats.keys()) {
        if (bfs1.hasCategoryDistance(catId)) {
          double d=bfs1.getCategoryDistance(catId) + bfs2.getCategoryDistance(catId) + 0 - graph.catCosts[catId];
          shortestDistance=Math.min(d,shortestDistance);
        }
      }
      maxDist2=Math.max(maxDist2,visited.maxCatDistance());
    }
  }
  return new SRResult(distanceToScore(shortestDistance));
}

Fixed version (ground truth):
@Override public SRResult similarity(int pageId1,int pageId2,boolean explanations) throws DaoException {
  CategoryBfs bfs1=new CategoryBfs(graph,pageId1,getLanguage(),Integer.MAX_VALUE,null,catHelper);
  CategoryBfs bfs2=new CategoryBfs(graph,pageId2,getLanguage(),Integer.MAX_VALUE,null,catHelper);
  bfs1.setAddPages(false);
  bfs1.setExploreChildren(false);
  bfs2.setAddPages(false);
  bfs2.setExploreChildren(false);
  double shortestDistance=Double.POSITIVE_INFINITY;
  double maxDist1=0;
  double maxDist2=0;
  while ((bfs1.hasMoreResults() || bfs2.hasMoreResults()) && (maxDist1 + maxDist2 < shortestDistance)) {
    while (bfs1.hasMoreResults() && (maxDist1 <= maxDist2 || !bfs2.hasMoreResults())) {
      CategoryBfs.BfsVisited visited=bfs1.step();
      for (      int catId : visited.cats.keys()) {
        if (bfs2.hasCategoryDistanceForIndex(catId)) {
          double d=bfs1.getCategoryDistanceForIndex(catId) + bfs2.getCategoryDistanceForIndex(catId) - graph.catCosts[catId];
          shortestDistance=Math.min(d,shortestDistance);
        }
      }
      maxDist1=Math.max(maxDist1,visited.maxCatDistance());
    }
    while (bfs2.hasMoreResults() && (maxDist2 <= maxDist1 || !bfs1.hasMoreResults())) {
      CategoryBfs.BfsVisited visited=bfs2.step();
      for (      int catId : visited.cats.keys()) {
        if (bfs1.hasCategoryDistanceForIndex(catId)) {
          double d=bfs1.getCategoryDistanceForIndex(catId) + bfs2.getCategoryDistanceForIndex(catId) + 0 - graph.catCosts[catId];
          shortestDistance=Math.min(d,shortestDistance);
        }
      }
      maxDist2=Math.max(maxDist2,visited.maxCatDistance());
    }
  }
  return new SRResult(distanceToScore(shortestDistance));
}