Program: 113425
Project: 113425
Buggy source:
protected FileMetadata loadFileMetadata(String fileId,StripingPolicyImpl sp) throws IOException {
  _stat_fileInfoLoads=0;
  FileMetadata info=new FileMetadata(sp);
  File fileDir=new File(generateAbsoluteFilePath(fileId));
  if (fileDir.exists()) {
    Map<Long,Long> largestObjVersions=new HashMap<Long,Long>();
    Map<Long,Map<Long,Long>> objChecksums=new HashMap<Long,Map<Long,Long>>();
    Map<Long,Long> latestObjVersions=null;
    long lastObjNum=-1;
    String lastObject=null;
    File currVerFile=new File(fileDir,CURRENT_VER_FILENAME);
    boolean multiVersionSupport=currVerFile.exists();
    if (multiVersionSupport) {
      latestObjVersions=new HashMap<Long,Long>();
      RandomAccessFile rf=new RandomAccessFile(currVerFile,"String_Node_Str");
      for (long l=0; ; l++) {
        try {
          long objVer=rf.readLong();
          if (objVer != 0)           latestObjVersions.put(l,objVer);
        }
 catch (        EOFException exc) {
          lastObjNum=l - 1;
          break;
        }
      }
      rf.close();
    }
    String[] objs=fileDir.list();
    for (    String obj : objs) {
      if (obj.startsWith("String_Node_Str")) {
        continue;
      }
      ObjFileData ofd=parseFileName(obj);
      if (ofd.checksum != 0) {
        Map<Long,Long> checksums=objChecksums.get(ofd.objNo);
        if (checksums == null) {
          checksums=new HashMap<Long,Long>();
          objChecksums.put(ofd.objNo,checksums);
        }
        checksums.put(ofd.objVersion,ofd.checksum);
      }
      if (multiVersionSupport) {
        Long latestObjVer=latestObjVersions.get(ofd.objNo);
        if (ofd.objNo == lastObjNum && latestObjVer != null && ofd.objVersion == latestObjVer)         lastObject=obj;
      }
 else {
        if (ofd.objNo > lastObjNum) {
          lastObject=obj;
          lastObjNum=ofd.objNo;
        }
      }
      Long oldver=largestObjVersions.get(ofd.objNo);
      if ((oldver == null) || (oldver < ofd.objVersion))       largestObjVersions.put((long)ofd.objNo,ofd.objVersion);
    }
    if (multiVersionSupport) {
      info.initLatestObjectVersions(latestObjVersions);
      info.initLargestObjectVersions(largestObjVersions);
    }
 else {
      info.initLatestObjectVersions(largestObjVersions);
      info.initLargestObjectVersions(largestObjVersions);
    }
    info.initObjectChecksums(objChecksums);
    if (lastObjNum > -1) {
      File lastObjFile=new File(fileDir.getAbsolutePath() + "String_Node_Str" + lastObject);
      long lastObjSize=lastObjFile.length();
      if (lastObjSize == 0) {
        lastObjSize=sp.getStripeSizeForObject(lastObjSize);
      }
      long fsize=lastObjSize;
      if (lastObjNum > 0) {
        fsize+=sp.getObjectEndOffset(lastObjNum - 1) + 1;
      }
      assert(fsize >= 0);
      info.setFilesize(fsize);
      info.setLastObjectNumber(lastObjNum);
    }
 else {
      info.setFilesize(0l);
      info.setLastObjectNumber(-1);
    }
    File tepoch=new File(fileDir,TEPOCH_FILENAME);
    if (tepoch.exists()) {
      RandomAccessFile raf=null;
      try {
        raf=new RandomAccessFile(tepoch,"String_Node_Str");
        info.setTruncateEpoch(raf.readLong());
      }
  finally {
        if (raf != null) {
          raf.close();
        }
      }
    }
    File vtFile=new File(fileDir,VTABLE_FILENAME);
    VersionTable vt=new VersionTable(vtFile);
    if (vtFile.exists())     vt.load();
    info.initVersionTable(vt);
  }
 else {
    info.setFilesize(0);
    info.setLastObjectNumber(-1);
    info.initLatestObjectVersions(new HashMap<Long,Long>());
    info.initLargestObjectVersions(new HashMap<Long,Long>());
    info.initObjectChecksums(new HashMap<Long,Map<Long,Long>>());
    info.initVersionTable(new VersionTable(new File(fileDir,VTABLE_FILENAME)));
  }
  info.setGlobalLastObjectNumber(-1);
  return info;
}

Fixed version (ground truth):
@Override protected FileMetadata loadFileMetadata(String fileId,StripingPolicyImpl sp) throws IOException {
  _stat_fileInfoLoads=0;
  FileMetadata info=new FileMetadata(sp);
  File fileDir=new File(generateAbsoluteFilePath(fileId));
  if (fileDir.exists()) {
    Map<Long,Long> largestObjVersions=new HashMap<Long,Long>();
    Map<Long,Map<Long,Long>> objChecksums=new HashMap<Long,Map<Long,Long>>();
    Map<Long,Long> latestObjVersions=null;
    long lastObjNum=-1;
    String lastObject=null;
    File currVerFile=new File(fileDir,CURRENT_VER_FILENAME);
    boolean multiVersionSupport=currVerFile.exists();
    if (multiVersionSupport) {
      latestObjVersions=new HashMap<Long,Long>();
      RandomAccessFile rf=new RandomAccessFile(currVerFile,"String_Node_Str");
      for (long l=0; ; l++) {
        try {
          long objVer=rf.readLong();
          if (objVer != 0)           latestObjVersions.put(l,objVer);
        }
 catch (        EOFException exc) {
          lastObjNum=l - 1;
          break;
        }
      }
      rf.close();
    }
    String[] objs=fileDir.list();
    for (    String obj : objs) {
      if (obj.startsWith("String_Node_Str")) {
        continue;
      }
      ObjFileData ofd=parseFileName(obj);
      if (ofd.checksum != 0) {
        Map<Long,Long> checksums=objChecksums.get(ofd.objNo);
        if (checksums == null) {
          checksums=new HashMap<Long,Long>();
          objChecksums.put(ofd.objNo,checksums);
        }
        checksums.put(ofd.objVersion,ofd.checksum);
      }
      if (multiVersionSupport) {
        Long latestObjVer=latestObjVersions.get(ofd.objNo);
        if (ofd.objNo == lastObjNum && latestObjVer != null && ofd.objVersion == latestObjVer)         lastObject=obj;
      }
 else {
        if (ofd.objNo > lastObjNum) {
          lastObject=obj;
          lastObjNum=ofd.objNo;
        }
      }
      Long oldver=largestObjVersions.get(ofd.objNo);
      if ((oldver == null) || (oldver < ofd.objVersion))       largestObjVersions.put(ofd.objNo,ofd.objVersion);
    }
    if (multiVersionSupport) {
      info.initLatestObjectVersions(latestObjVersions);
      info.initLargestObjectVersions(largestObjVersions);
    }
 else {
      info.initLatestObjectVersions(largestObjVersions);
      info.initLargestObjectVersions(largestObjVersions);
    }
    info.initObjectChecksums(objChecksums);
    if (lastObjNum > -1) {
      File lastObjFile=new File(fileDir.getAbsolutePath() + "String_Node_Str" + lastObject);
      long lastObjSize=lastObjFile.length();
      if (lastObjSize == 0) {
        lastObjSize=sp.getStripeSizeForObject(lastObjSize);
      }
      long fsize=lastObjSize;
      if (lastObjNum > 0) {
        fsize+=sp.getObjectEndOffset(lastObjNum - 1) + 1;
      }
      assert(fsize >= 0);
      info.setFilesize(fsize);
      info.setLastObjectNumber(lastObjNum);
    }
 else {
      info.setFilesize(0l);
      info.setLastObjectNumber(-1);
    }
    File tepoch=new File(fileDir,TEPOCH_FILENAME);
    if (tepoch.exists()) {
      RandomAccessFile raf=null;
      try {
        raf=new RandomAccessFile(tepoch,"String_Node_Str");
        info.setTruncateEpoch(raf.readLong());
      }
  finally {
        if (raf != null) {
          raf.close();
        }
      }
    }
    File vtFile=new File(fileDir,VTABLE_FILENAME);
    VersionTable vt=new VersionTable(vtFile);
    if (vtFile.exists())     vt.load();
    info.initVersionTable(vt);
  }
 else {
    info.setFilesize(0);
    info.setLastObjectNumber(-1);
    info.initLatestObjectVersions(new HashMap<Long,Long>());
    info.initLargestObjectVersions(new HashMap<Long,Long>());
    info.initObjectChecksums(new HashMap<Long,Map<Long,Long>>());
    info.initVersionTable(new VersionTable(new File(fileDir,VTABLE_FILENAME)));
  }
  info.setGlobalLastObjectNumber(-1);
  return info;
}