Source:
<code>private LogData getLogData(LogEntry entry) { <START> ByteBuffer entryData = ByteBuffer.wrap(entry.getData().toByteArray()); if (entry.hasCodecType() && entryData.hasRemaining()) { Codec.Type codec = Codec.Type.values()[entry.getCodecType()]; entryData = codec.getInstance().decompress(entryData); } LogData logData = new LogData(org.corfudb.protocols.wireprotocol .DataType.typeMap.get((byte) entry.getDataType().getNumber()), Unpooled.wrappedBuffer(entryData.array())); <END> logData.setBackpointerMap(getUUIDLongMap(entry.getBackpointersMap())); logData.setGlobalAddress(entry.getGlobalAddress()); logData.setRank(createDataRank(entry)); if (entry.hasThreadId()) { logData.setThreadId(entry.getThreadId()); } if (entry.hasClientIdLeastSignificant() && entry.hasClientIdMostSignificant()) { long lsd = entry.getClientIdLeastSignificant(); long msd = entry.getClientIdMostSignificant(); logData.setClientId(new UUID(msd, lsd)); } if (entry.hasCheckpointEntryType()) { logData.setCheckpointType(CheckpointEntry.CheckpointEntryType .typeMap.get((byte) entry.getCheckpointEntryType().ordinal())); if (!entry.hasCheckpointIdLeastSignificant() || !entry.hasCheckpointIdMostSignificant()) { log.error("Checkpoint has missing information {}", entry); } long lsd = entry.getCheckpointIdLeastSignificant(); long msd = entry.getCheckpointIdMostSignificant(); UUID checkpointId = new UUID(msd, lsd); logData.setCheckpointId(checkpointId); lsd = entry.getCheckpointedStreamIdLeastSignificant(); msd = entry.getCheckpointedStreamIdMostSignificant(); UUID streamId = new UUID(msd, lsd); logData.setCheckpointedStreamId(streamId); logData.setCheckpointedStreamStartLogAddress( entry.getCheckpointedStreamStartLogAddress()); } return logData; }</code><technical_language>I understand necessity convert ByteBuf ByteBuffer here, add a TODO clean up</technical_language>

Target:
private LogData getLogData(LogEntry entry) { ByteBuffer entryData = ByteBuffer.wrap(entry.getData().toByteArray()); if (entry.hasCodecType() && entryData.hasRemaining()) { Codec codec = Codec.getById(entry.getCodecType()); entryData = codec.decompress(entryData); } LogData logData = new LogData(org.corfudb.protocols.wireprotocol .DataType.typeMap.get((byte) entry.getDataType().getNumber()), Unpooled.wrappedBuffer(entryData.array())); logData.setBackpointerMap(getUUIDLongMap(entry.getBackpointersMap())); logData.setGlobalAddress(entry.getGlobalAddress()); logData.setRank(createDataRank(entry)); if (entry.hasThreadId()) { logData.setThreadId(entry.getThreadId()); } if (entry.hasClientIdLeastSignificant() && entry.hasClientIdMostSignificant()) { long lsd = entry.getClientIdLeastSignificant(); long msd = entry.getClientIdMostSignificant(); logData.setClientId(new UUID(msd, lsd)); } if (entry.hasCheckpointEntryType()) { logData.setCheckpointType(CheckpointEntry.CheckpointEntryType .typeMap.get((byte) entry.getCheckpointEntryType().ordinal())); if (!entry.hasCheckpointIdLeastSignificant() || !entry.hasCheckpointIdMostSignificant()) { log.error("Checkpoint has missing information {}", entry); } long lsd = entry.getCheckpointIdLeastSignificant(); long msd = entry.getCheckpointIdMostSignificant(); UUID checkpointId = new UUID(msd, lsd); logData.setCheckpointId(checkpointId); lsd = entry.getCheckpointedStreamIdLeastSignificant(); msd = entry.getCheckpointedStreamIdMostSignificant(); UUID streamId = new UUID(msd, lsd); logData.setCheckpointedStreamId(streamId); logData.setCheckpointedStreamStartLogAddress( entry.getCheckpointedStreamStartLogAddress()); } return logData; }