Program: 98169
Project: 98169
Buggy source:
@Override public String checkDb(){
  final byte ROOT=1;
  final byte IDX_FSM=2;
  final byte IDX_OID=3;
  final byte IDX_POS=4;
  final byte IDX_ATTR=5;
  final byte DATA=6;
  final byte FREE=7;
  int nObjects=0;
  int nObjectsByPos=0;
  int nPosEntries=0;
  int nPagesFree=0;
  int nPagesRoot=0;
  int nPagesData=0;
  int nPages=freeIndex.getPageCount();
  byte[] pages=new byte[nPages];
  pages[0]=ROOT;
  pages[1]=ROOT;
  pages[2]=ROOT;
  Iterator<FilePos> oi=oidIndex.iterator();
  while (oi.hasNext()) {
    FilePos fp=oi.next();
    pages[fp.getPage()]=DATA;
    nObjects++;
  }
  Collection<SchemaIndexEntry> sList=schemaIndex.getSchemata();
  int nPosIndexPages=0;
  for (  SchemaIndexEntry se : sList) {
    PagedPosIndex.ObjectPosIteratorMerger opi=se.getObjectIndexIterator();
    while (opi.hasNextOPI()) {
      nPosEntries++;
      long pos=opi.nextPos();
      pages[BitTools.getPage(pos)]=DATA;
      nObjectsByPos++;
    }
    for (int v=0; v < se.getObjectIndexVersionCount(); v++) {
      List<Integer> pageList=se.getObjectIndexVersion(v).debugPageIds();
      nPosIndexPages+=pageList.size();
      for (      Integer i : pageList) {
        if (pages[i] != 0) {
          System.err.println("String_Node_Str" + i);
        }
        pages[i]=IDX_POS;
      }
    }
  }
  List<Integer> pageList=schemaIndex.debugPageIdsAttrIdx();
  int nAttrIndexPages=pageList.size();
  for (  Integer i : pageList) {
    if (pages[i] != 0) {
      System.err.println("String_Node_Str" + i);
    }
    pages[i]=IDX_ATTR;
  }
  pageList=oidIndex.debugPageIds();
  int nOidPages=pageList.size();
  for (  Integer i : pageList) {
    if (pages[i] != 0) {
      System.err.println("String_Node_Str" + i);
    }
    pages[i]=IDX_OID;
  }
  pageList=freeIndex.debugPageIds();
  int nFsmPages=pageList.size();
  for (  Integer i : pageList) {
    if (pages[i] != 0) {
      System.err.println("String_Node_Str" + i);
    }
    pages[i]=IDX_FSM;
  }
  Iterator<LLEntry> fiIter=freeIndex.debugIterator();
  int nPagesFreeDoNotUse=0;
  while (fiIter.hasNext()) {
    LLEntry e=fiIter.next();
    if (pages[(int)e.getKey()] != 0) {
      if (e.getValue() == 0) {
        System.err.println("String_Node_Str" + e.getKey());
      }
 else {
        nPagesFreeDoNotUse++;
      }
    }
    pages[(int)e.getKey()]=FREE;
    nPagesFree++;
  }
  int nPagesFree2=0;
  int nPagesUnknown=0;
  int nIndexPages=0;
  for (  byte b : pages) {
switch (b) {
case ROOT:
      nPagesRoot++;
    break;
case DATA:
  nPagesData++;
break;
case FREE:
nPagesFree2++;
break;
case IDX_FSM:
case IDX_ATTR:
case IDX_OID:
case IDX_POS:
nIndexPages++;
break;
default :
nPagesUnknown++;
}
}
FormattedStringBuilder sb=new FormattedStringBuilder();
sb.appendln("String_Node_Str" + nObjects + "String_Node_Str"+ nObjectsByPos);
if (nObjects != nObjectsByPos + sList.size()) {
sb.appendln("String_Node_Str");
}
sb.appendln("String_Node_Str" + sList.size());
sb.appendln("String_Node_Str" + nPosEntries);
sb.appendln();
sb.appendln("String_Node_Str" + nOidPages);
sb.appendln("String_Node_Str" + nFsmPages);
sb.appendln("String_Node_Str" + nPagesFreeDoNotUse);
sb.appendln("String_Node_Str" + nPosIndexPages);
sb.appendln("String_Node_Str" + nAttrIndexPages);
sb.appendln("String_Node_Str" + nIndexPages);
sb.appendln();
sb.appendln("String_Node_Str" + nPagesFree + "String_Node_Str"+ nPagesFree2);
sb.appendln("String_Node_Str" + nPagesData);
sb.appendln("String_Node_Str" + nPagesRoot);
sb.appendln("String_Node_Str" + nIndexPages);
sb.appendln("String_Node_Str" + nPagesUnknown);
sb.appendln("String_Node_Str" + nPages);
return sb.toString();
}

Fixed version (ground truth):
@Override public String checkDb(){
  final byte ROOT=1;
  final byte IDX_FSM=2;
  final byte IDX_OID=3;
  final byte IDX_POS=4;
  final byte IDX_ATTR=5;
  final byte DATA=6;
  final byte FREE=7;
  int nObjects=0;
  int nObjectsByPos=0;
  int nPosEntries=0;
  int nPagesFree=0;
  int nPagesRoot=0;
  int nPagesData=0;
  int nPages=freeIndex.getPageCount();
  byte[] pages=new byte[nPages];
  pages[0]=ROOT;
  pages[1]=ROOT;
  pages[2]=ROOT;
  Iterator<FilePos> oi=oidIndex.iterator();
  while (oi.hasNext()) {
    FilePos fp=oi.next();
    pages[fp.getPage()]=DATA;
    nObjects++;
  }
  Collection<SchemaIndexEntry> sList=schemaIndex.getSchemata();
  int nPosIndexPages=0;
  for (  SchemaIndexEntry se : sList) {
    PagedPosIndex.ObjectPosIteratorMerger opi=se.getObjectIndexIterator();
    while (opi.hasNextOPI()) {
      nPosEntries++;
      long pos=opi.nextPos();
      pages[BitTools.getPage(pos)]=DATA;
      nObjectsByPos++;
    }
    for (int v=0; v < se.getObjectIndexVersionCount(); v++) {
      List<Integer> pageList=se.getObjectIndexVersion(v).debugPageIds();
      nPosIndexPages+=pageList.size();
      for (      Integer i : pageList) {
        if (pages[i] != 0) {
          System.err.println("String_Node_Str" + i);
        }
        pages[i]=IDX_POS;
      }
    }
  }
  List<Integer> pageList=schemaIndex.debugPageIdsAttrIdx();
  int nAttrIndexPages=pageList.size();
  for (  Integer i : pageList) {
    if (pages[i] != 0) {
      System.err.println("String_Node_Str" + i);
    }
    pages[i]=IDX_ATTR;
  }
  pageList=oidIndex.debugPageIds();
  int nOidPages=pageList.size();
  for (  Integer i : pageList) {
    if (pages[i] != 0) {
      System.err.println("String_Node_Str" + i);
    }
    pages[i]=IDX_OID;
  }
  pageList=freeIndex.debugPageIds();
  int nFsmPages=pageList.size();
  for (  Integer i : pageList) {
    if (pages[i] != 0) {
      System.err.println("String_Node_Str" + i);
    }
    pages[i]=IDX_FSM;
  }
  Iterator<LLEntry> fiIter=freeIndex.debugIterator();
  int nPagesFreeDoNotUse=0;
  while (fiIter.hasNext()) {
    LLEntry e=fiIter.next();
    if (pages[(int)e.getKey()] != 0) {
      if (e.getValue() == 0) {
        System.err.println("String_Node_Str" + e.getKey());
      }
 else {
        nPagesFreeDoNotUse++;
      }
    }
    pages[(int)e.getKey()]=FREE;
    nPagesFree++;
  }
  int nPagesFree2=0;
  int nPagesUnknown=0;
  int nIndexPages=0;
  for (  byte b : pages) {
switch (b) {
case ROOT:
      nPagesRoot++;
    break;
case DATA:
  nPagesData++;
break;
case FREE:
nPagesFree2++;
break;
case IDX_FSM:
case IDX_ATTR:
case IDX_OID:
case IDX_POS:
nIndexPages++;
break;
default :
nPagesUnknown++;
}
}
FormattedStringBuilder sb=new FormattedStringBuilder();
sb.appendln("String_Node_Str" + nObjects + "String_Node_Str"+ nObjectsByPos);
if (nObjects != nObjectsByPos) {
sb.appendln("String_Node_Str");
}
sb.appendln("String_Node_Str" + sList.size());
sb.appendln("String_Node_Str" + nPosEntries);
sb.appendln();
sb.appendln("String_Node_Str" + nOidPages);
sb.appendln("String_Node_Str" + nFsmPages);
sb.appendln("String_Node_Str" + nPagesFreeDoNotUse);
sb.appendln("String_Node_Str" + nPosIndexPages);
sb.appendln("String_Node_Str" + nAttrIndexPages);
sb.appendln("String_Node_Str" + nIndexPages);
sb.appendln();
sb.appendln("String_Node_Str" + nPagesFree + "String_Node_Str"+ nPagesFree2);
sb.appendln("String_Node_Str" + nPagesData);
sb.appendln("String_Node_Str" + nPagesRoot);
sb.appendln("String_Node_Str" + nIndexPages);
sb.appendln("String_Node_Str" + nPagesUnknown);
sb.appendln("String_Node_Str" + nPages);
return sb.toString();
}