Program: 52904
Project: 52904
Buggy source:
private void buildGraph(CategoryGraph graph,LocalCategoryMemberDao lcmDao) throws DaoException {
  LOG.info("String_Node_Str");
  graph.catPages=new int[graph.catIndexes.size()][];
  graph.catParents=new int[graph.catIndexes.size()][];
  graph.catChildren=new int[graph.catIndexes.size()][];
  graph.catCosts=new double[graph.catIndexes.size()];
  Arrays.fill(graph.catPages,new int[0]);
  Arrays.fill(graph.catParents,new int[0]);
  Arrays.fill(graph.catChildren,new int[0]);
  int totalEdges=0;
  int numCatChildren[]=new int[graph.catIndexes.size()];
  int numCatParents[]=new int[graph.catIndexes.size()];
  int numCatPages[]=new int[graph.catIndexes.size()];
  DaoFilter filter=new DaoFilter().setLanguages(graph.language);
  for (  LocalCategoryMember lcm : lcmDao.get(filter)) {
    int catIndex1=graph.getCategoryIndex(lcm.getArticleId());
    int catIndex2=graph.getCategoryIndex(lcm.getCategoryId());
    if (catIndex1 >= 0 && catIndex2 >= 0) {
      numCatChildren[catIndex2]++;
      numCatParents[catIndex1]++;
    }
 else     if (catIndex2 >= 0) {
      numCatPages[catIndex2]++;
    }
    totalEdges++;
  }
  for (int i=0; i < graph.catIndexes.size(); i++) {
    graph.catPages[i]=new int[numCatPages[i]];
    graph.catChildren[i]=new int[numCatChildren[i]];
    graph.catParents[i]=new int[numCatParents[i]];
  }
  for (  LocalCategoryMember lcm : lcmDao.get(filter)) {
    int catIndex1=graph.getCategoryIndex(lcm.getArticleId());
    int catIndex2=graph.getCategoryIndex(lcm.getCategoryId());
    if (catIndex1 >= 0 && catIndex2 >= 0) {
      graph.catChildren[catIndex2][--numCatChildren[catIndex2]]=catIndex1;
      graph.catParents[catIndex1][--numCatParents[catIndex1]]=catIndex2;
    }
 else     if (catIndex2 >= 0) {
      graph.catPages[catIndex2][--numCatPages[catIndex2]]=lcm.getArticleId();
    }
  }
  for (  int n : numCatChildren) {
    assert(n == 0);
  }
  for (  int n : numCatPages) {
    assert(n == 0);
  }
  for (  int n : numCatParents) {
    assert(n == 0);
  }
  LOG.info("String_Node_Str" + totalEdges + "String_Node_Str");
}

Fixed version (ground truth):
private void buildGraph(CategoryGraph graph) throws DaoException {
  LOG.info("String_Node_Str");
  graph.catPages=new int[graph.catIndexes.size()][];
  graph.catParents=new int[graph.catIndexes.size()][];
  graph.catChildren=new int[graph.catIndexes.size()][];
  graph.catCosts=new double[graph.catIndexes.size()];
  Arrays.fill(graph.catPages,new int[0]);
  Arrays.fill(graph.catParents,new int[0]);
  Arrays.fill(graph.catChildren,new int[0]);
  int totalEdges=0;
  int numCatChildren[]=new int[graph.catIndexes.size()];
  int numCatParents[]=new int[graph.catIndexes.size()];
  int numCatPages[]=new int[graph.catIndexes.size()];
  DaoFilter filter=new DaoFilter().setLanguages(graph.language);
  for (  LocalCategoryMember lcm : catDao.get(filter)) {
    int catIndex1=graph.getCategoryIndex(lcm.getArticleId());
    int catIndex2=graph.getCategoryIndex(lcm.getCategoryId());
    if (catIndex1 >= 0 && catIndex2 >= 0) {
      numCatChildren[catIndex2]++;
      numCatParents[catIndex1]++;
    }
 else     if (catIndex2 >= 0) {
      numCatPages[catIndex2]++;
    }
    totalEdges++;
  }
  for (int i=0; i < graph.catIndexes.size(); i++) {
    graph.catPages[i]=new int[numCatPages[i]];
    graph.catChildren[i]=new int[numCatChildren[i]];
    graph.catParents[i]=new int[numCatParents[i]];
  }
  for (  LocalCategoryMember lcm : catDao.get(filter)) {
    int catIndex1=graph.getCategoryIndex(lcm.getArticleId());
    int catIndex2=graph.getCategoryIndex(lcm.getCategoryId());
    if (catIndex1 >= 0 && catIndex2 >= 0) {
      graph.catChildren[catIndex2][--numCatChildren[catIndex2]]=catIndex1;
      graph.catParents[catIndex1][--numCatParents[catIndex1]]=catIndex2;
    }
 else     if (catIndex2 >= 0) {
      graph.catPages[catIndex2][--numCatPages[catIndex2]]=lcm.getArticleId();
    }
  }
  for (  int n : numCatChildren) {
    assert(n == 0);
  }
  for (  int n : numCatPages) {
    assert(n == 0);
  }
  for (  int n : numCatParents) {
    assert(n == 0);
  }
  LOG.info("String_Node_Str" + totalEdges + "String_Node_Str");
}