Program: 132426
Project: 132426
Buggy source:
/** 
 * Load the most recent snapshots of each tree.
 * @param numIndices the number of indices to read.
 * @throws java.io.IOException if the on-disk data cannot be read
 */
private void loadFromDisk(int numIndices) throws BabuDBException {
  Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + this.databaseName + "String_Node_Str");
  for (int index=0; index < numIndices; index++) {
    trees.add(null);
  }
  for (int index=0; index < numIndices; index++) {
    final int idx=index;
    File f=new File(databaseDir);
    String[] files=f.list(new FilenameFilter(){
      public boolean accept(      File dir,      String name){
        return name.startsWith("String_Node_Str" + idx + "String_Node_Str");
      }
    }
);
    int maxView=-1;
    int maxSeq=-1;
    Pattern p=Pattern.compile(SNAPSHOT_FILENAME_REGEXP);
    for (    String fname : files) {
      Matcher m=p.matcher(fname);
      m.matches();
      Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + fname);
      int view=Integer.valueOf(m.group(2));
      int seq=Integer.valueOf(m.group(3));
      if (view > maxView) {
        maxView=view;
        maxSeq=seq;
      }
 else       if (view == maxView) {
        if (seq > maxSeq)         maxSeq=seq;
      }
    }
    try {
      if (maxView > -1) {
        Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + this.databaseName + "String_Node_Str"+ databaseDir+ "String_Node_Str"+ index+ "String_Node_Str"+ maxView+ "String_Node_Str"+ maxSeq);
        assert(comparators[index] != null);
        trees.set(index,new LSMTree(databaseDir + getSnapshotFilename(index,maxView,maxSeq),comparators[index]));
        ondiskLSN=new LSN(maxView,maxSeq);
      }
 else {
        Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + this.databaseName);
        assert(comparators[index] != null);
        trees.set(index,new LSMTree(null,comparators[index]));
      }
    }
 catch (    IOException ex) {
      throw new BabuDBException(ErrorCode.IO_ERROR,"String_Node_Str",ex);
    }
  }
}

Fixed version (ground truth):
/** 
 * Load the most recent snapshots of each tree.
 * @param numIndices the number of indices to read.
 * @throws java.io.IOException if the on-disk data cannot be read
 */
private void loadFromDisk(int numIndices) throws BabuDBException {
  Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + this.databaseName + "String_Node_Str");
  for (int index=0; index < numIndices; index++) {
    trees.add(null);
  }
  for (int index=0; index < numIndices; index++) {
    final int idx=index;
    File f=new File(databaseDir);
    String[] files=f.list(new FilenameFilter(){
      public boolean accept(      File dir,      String name){
        return name.startsWith("String_Node_Str" + idx + "String_Node_Str");
      }
    }
);
    int maxView=-1;
    int maxSeq=-1;
    Pattern p=Pattern.compile(SNAPSHOT_FILENAME_REGEXP);
    for (    String fname : files) {
      Matcher m=p.matcher(fname);
      m.matches();
      Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + fname);
      int view=Integer.valueOf(m.group(2));
      int seq=Integer.valueOf(m.group(3));
      if (view > maxView) {
        maxView=view;
        maxSeq=seq;
      }
 else       if (view == maxView) {
        if (seq > maxSeq)         maxSeq=seq;
      }
    }
    try {
      if (maxView > -1) {
        Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + this.databaseName + "String_Node_Str"+ databaseDir+ "String_Node_Str"+ index+ "String_Node_Str"+ maxView+ "String_Node_Str"+ maxSeq);
        assert(comparators[index] != null);
        trees.set(index,new LSMTree(databaseDir + getSnapshotFilename(index,maxView,maxSeq),comparators[index]));
        ondiskLSN=new LSN(maxView,maxSeq);
      }
 else {
        ondiskLSN=new LSN(0,0);
        Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + this.databaseName);
        assert(comparators[index] != null);
        trees.set(index,new LSMTree(null,comparators[index]));
      }
    }
 catch (    IOException ex) {
      throw new BabuDBException(ErrorCode.IO_ERROR,"String_Node_Str",ex);
    }
  }
}