Program: 113869
Project: 113869
Buggy source:
public static BufferBackedFileMetadata resolveLink(BabuDB database,String dbName,long linkParentId,byte[][] keyBufs,byte[][] valBufs) throws BabuDBException {
  String linkName=new String(valBufs[FileMetadata.RC_METADATA],9,valBufs[FileMetadata.RC_METADATA].length - 9);
  byte[] fileIdBytes=new byte[8];
  System.arraycopy(valBufs[FileMetadata.RC_METADATA],1,fileIdBytes,0,fileIdBytes.length);
  Iterator<Entry<byte[],byte[]>> it=database.syncPrefixLookup(dbName,BabuDBStorageManager.LINK_INDEX,fileIdBytes);
  while (it.hasNext()) {
    Entry<byte[],byte[]> curr=it.next();
    int type=getType(curr.getKey(),true);
    valBufs[type]=curr.getValue();
  }
  BufferBackedRCMetadata rcMetadata=new BufferBackedRCMetadata(keyBufs[BufferBackedFileMetadata.RC_METADATA],valBufs[BufferBackedFileMetadata.RC_METADATA]);
  BufferBackedRCMetadata tmp=new BufferBackedRCMetadata(linkParentId,linkName,rcMetadata.getOwnerId(),rcMetadata.getOwningGroupId(),rcMetadata.getId(),rcMetadata.getPerms(),rcMetadata.getLinkCount(),rcMetadata.getEpoch(),rcMetadata.getIssuedEpoch(),rcMetadata.isReadOnly(),rcMetadata.getCollisionCount());
  keyBufs[BufferBackedFileMetadata.FC_METADATA]=new byte[tmp.getKey().length];
  System.arraycopy(tmp.getKey(),0,keyBufs[BufferBackedFileMetadata.FC_METADATA],0,tmp.getKey().length);
  keyBufs[BufferBackedFileMetadata.FC_METADATA][12]=0;
  keyBufs[BufferBackedFileMetadata.XLOC_METADATA]=new byte[tmp.getKey().length];
  System.arraycopy(tmp.getKey(),0,keyBufs[BufferBackedFileMetadata.XLOC_METADATA],0,tmp.getKey().length);
  keyBufs[BufferBackedFileMetadata.XLOC_METADATA][12]=2;
  keyBufs[BufferBackedFileMetadata.RC_METADATA]=tmp.getKey();
  valBufs[BufferBackedFileMetadata.RC_METADATA]=tmp.getValue();
  return new BufferBackedFileMetadata(keyBufs,valBufs,true);
}

Fixed version (ground truth):
public static BufferBackedFileMetadata resolveLink(BabuDB database,String dbName,byte[] target) throws BabuDBException {
  byte[] fileIdBytes=new byte[8];
  System.arraycopy(target,1,fileIdBytes,0,fileIdBytes.length);
  String fileName=new String(target,9,target.length - 9);
  byte[][] valBufs=new byte[BufferBackedFileMetadata.NUM_BUFFERS][];
  Iterator<Entry<byte[],byte[]>> it=database.syncPrefixLookup(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,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.getLinkCount(),tmp.getCollisionCount()) : new BufferBackedRCMetadata(0,fileName,tmp.getOwnerId(),tmp.getOwningGroupId(),tmp.getId(),tmp.getPerms(),tmp.getLinkCount(),tmp.getEpoch(),tmp.getIssuedEpoch(),tmp.isReadOnly(),tmp.getCollisionCount());
  valBufs[FileMetadata.RC_METADATA]=tmp2.getValue();
  return new BufferBackedFileMetadata(null,valBufs,BabuDBStorageManager.FILE_ID_INDEX);
}