Program: 113614
Project: 113614
Buggy source:
public static BufferBackedFileMetadata resolveLink(BabuDB database,String dbName,byte[] target,String fileName) throws BabuDBException {
  byte[] fileIdBytes=new byte[8];
  System.arraycopy(target,1,fileIdBytes,0,fileIdBytes.length);
  byte[][] valBufs=new byte[BufferBackedFileMetadata.NUM_BUFFERS][];
  Iterator<Entry<byte[],byte[]>> it=database.directPrefixLookup(dbName,BabuDBStorageManager.FILE_ID_INDEX,fileIdBytes);
  while (it.hasNext()) {
    Entry<byte[],byte[]> curr=it.next();
    int type=getType(curr.getKey(),BabuDBStorageManager.FILE_ID_INDEX);
    if (type == 3) {
      long fileId=ByteBuffer.wrap(fileIdBytes).getLong();
      Logging.logMessage(Logging.LEVEL_WARN,Category.db,(Object)null,"String_Node_Str",fileId);
      continue;
    }
    valBufs[type]=curr.getValue();
  }
  if (valBufs[FileMetadata.RC_METADATA] == null)   return null;
  BufferBackedRCMetadata tmp=new BufferBackedRCMetadata(null,valBufs[FileMetadata.RC_METADATA]);
  BufferBackedRCMetadata tmp2=tmp.isDirectory() ? new BufferBackedRCMetadata(0,fileName,tmp.getOwnerId(),tmp.getOwningGroupId(),tmp.getId(),tmp.getPerms(),tmp.getW32Attrs(),tmp.getLinkCount()) : new BufferBackedRCMetadata(0,fileName,tmp.getOwnerId(),tmp.getOwningGroupId(),tmp.getId(),tmp.getPerms(),tmp.getW32Attrs(),tmp.getLinkCount(),tmp.getEpoch(),tmp.getIssuedEpoch(),tmp.isReadOnly());
  valBufs[FileMetadata.RC_METADATA]=tmp2.getValue();
  byte[][] keyBufs=new byte[][]{null,tmp2.getKey()};
  return new BufferBackedFileMetadata(keyBufs,valBufs,BabuDBStorageManager.FILE_ID_INDEX);
}

Fixed version (ground truth):
public static BufferBackedFileMetadata resolveLink(BabuDB database,String dbName,byte[] target,String fileName) throws BabuDBException {
  byte[] fileIdBytes=new byte[8];
  System.arraycopy(target,1,fileIdBytes,0,fileIdBytes.length);
  byte[][] valBufs=new byte[BufferBackedFileMetadata.NUM_BUFFERS][];
  Iterator<Entry<byte[],byte[]>> it=database.directPrefixLookup(dbName,BabuDBStorageManager.FILE_ID_INDEX,fileIdBytes);
  while (it.hasNext()) {
    Entry<byte[],byte[]> curr=it.next();
    int type=getType(curr.getKey(),BabuDBStorageManager.FILE_ID_INDEX);
    if (type == 3) {
      long fileId=ByteBuffer.wrap(fileIdBytes).getLong();
      Logging.logMessage(Logging.LEVEL_WARN,Category.db,(Object)null,"String_Node_Str",fileId);
      continue;
    }
    valBufs[type]=curr.getValue();
  }
  if (valBufs[FileMetadata.RC_METADATA] == null)   return null;
  BufferBackedRCMetadata tmp=new BufferBackedRCMetadata(null,valBufs[FileMetadata.RC_METADATA]);
  BufferBackedRCMetadata tmp2=tmp.isDirectory() ? new BufferBackedRCMetadata(0,fileName,tmp.getOwnerId(),tmp.getOwningGroupId(),tmp.getId(),tmp.getPerms(),tmp.getW32Attrs(),tmp.getLinkCount()) : new BufferBackedRCMetadata(0,fileName,tmp.getOwnerId(),tmp.getOwningGroupId(),tmp.getId(),tmp.getPerms(),tmp.getW32Attrs(),tmp.getLinkCount(),tmp.getEpoch(),tmp.getIssuedEpoch(),tmp.isReadOnly());
  tmp2.setXLocList(tmp.getXLocList());
  valBufs[FileMetadata.RC_METADATA]=tmp2.getValue();
  byte[][] keyBufs=new byte[][]{null,tmp2.getKey()};
  return new BufferBackedFileMetadata(keyBufs,valBufs,BabuDBStorageManager.FILE_ID_INDEX);
}