Source:
private void verifyChecksum(ByteBuffer buffer, long fileId, long pageIndex) { assert buffer.order() == ByteOrder.nativeOrder(); buffer.position(0); final long magicNumber = OLongSerializer.INSTANCE.deserializeFromByteBufferObject(buffer); if (magicNumber != MAGIC_NUMBER_WITH_CHECKSUM) { if (magicNumber != MAGIC_NUMBER_WITHOUT_CHECKSUM) { final String message = "Magic number verification failed for page `" + pageIndex + "` of `" + fileNameById(fileId) + "`."; OLogManager.instance().error(this, "%s", message); if (checksumMode == OChecksumMode.StoreAndThrow) throw new OStorageException(message); } return; } buffer.position(OLongSerializer.LONG_SIZE); final int storedChecksum = OIntegerSerializer.INSTANCE.deserializeFromByteBufferObject(buffer); final CRC32 crc32 = new CRC32(); buffer.position(PAGE_OFFSET_TO_CHECKSUM_FROM); boolean fallbackToArray = true; if (CRC32_UPDATE_BYTE_BUFFER != null) { try { CRC32_UPDATE_BYTE_BUFFER.invoke(crc32, buffer); fallbackToArray = false; } catch (IllegalAccessException e) { } catch (InvocationTargetException e) { } } if (fallbackToArray) { final int dataLength = buffer.limit() - PAGE_OFFSET_TO_CHECKSUM_FROM; final byte[] data = new byte[dataLength]; buffer.get(data, PAGE_OFFSET_TO_CHECKSUM_FROM, dataLength); crc32.update(data); } final int computedChecksum = (int) crc32.getValue(); if (computedChecksum != storedChecksum) { final String message = "Checksum verification failed for page `" + pageIndex + "` of `" + fileNameById(fileId) + "`."; OLogManager.instance().error(this, "%s", message); if (checksumMode == OChecksumMode.StoreAndThrow) throw new OStorageException(message); } }

Target:
private void verifyChecksum(ByteBuffer buffer, long fileId, long pageIndex) { assert buffer.order() == ByteOrder.nativeOrder(); buffer.position(MAGIC_NUMBER_OFFSET); final long magicNumber = OLongSerializer.INSTANCE.deserializeFromByteBufferObject(buffer); if (magicNumber != MAGIC_NUMBER_WITH_CHECKSUM) { if (magicNumber != MAGIC_NUMBER_WITHOUT_CHECKSUM) { final String message = "Magic number verification failed for page `" + pageIndex + "` of `" + fileNameById(fileId) + "`."; OLogManager.instance().error(this, "%s", message); if (checksumMode == OChecksumMode.StoreAndThrow) throw new OStorageException(message); } return; } buffer.position(CHECKSUM_OFFSET); final int storedChecksum = OIntegerSerializer.INSTANCE.deserializeFromByteBufferObject(buffer); final CRC32 crc32 = new CRC32(); buffer.position(PAGE_OFFSET_TO_CHECKSUM_FROM); boolean fallbackToArray = true; if (crc32UpdateByteBuffer != null) { try { crc32UpdateByteBuffer.invoke(crc32, buffer); fallbackToArray = false; } catch (IllegalAccessException e) { logCrc32ArraysWarningAndSwitchToArrays(e); } catch (InvocationTargetException e) { logCrc32ArraysWarningAndSwitchToArrays(e); } } if (fallbackToArray) { final int dataLength = buffer.limit() - PAGE_OFFSET_TO_CHECKSUM_FROM; final byte[] data = new byte[dataLength]; buffer.get(data, PAGE_OFFSET_TO_CHECKSUM_FROM, dataLength); crc32.update(data); } final int computedChecksum = (int) crc32.getValue(); if (computedChecksum != storedChecksum) { final String message = "Checksum verification failed for page `" + pageIndex + "` of `" + fileNameById(fileId) + "`."; OLogManager.instance().error(this, "%s", message); if (checksumMode == OChecksumMode.StoreAndThrow) throw new OStorageException(message); } }