Source:
<code>public PageFileFooterReader( FSDataInputStream inputStream, long fileSize) throws IOException { checkArgument(fileSize >= FOOTER_LENGTH_IN_BYTES, "Malformed PageFile format, footer length is missing."); requireNonNull(inputStream, "inputStream is null"); ImmutableList.Builder<Long> stripeOffsetsBuilder = ImmutableList.builder(); byte[] buffer = new byte[toIntExact(min(fileSize, ESTIMATED_FOOTER_SIZE))]; inputStream.readFully(fileSize - buffer.length, buffer); int footerSize = Slices.wrappedBuffer(buffer, buffer.length - FOOTER_LENGTH_IN_BYTES, FOOTER_LENGTH_IN_BYTES).getInt(0); footerOffset = fileSize - footerSize; HiveCompressionCodec compression; if (footerOffset < 0) { throw new PageFileCorruptionException("Malformed PageFile format, incorrect footer length."); } else if (footerOffset > 0) { if (footerSize > buffer.length) { buffer = new byte[footerSize]; <START> inputStream.readFully(footerOffset, buffer); <END> } FixedLengthSliceInput sliceInput = Slices.wrappedBuffer(buffer, buffer.length - footerSize, footerSize - FOOTER_LENGTH_IN_BYTES).getInput(); long remainingSize = sliceInput.length(); int compressionStringSize = sliceInput.readInt(); remainingSize -= SIZE_OF_INT; String compressionName = sliceInput.readSlice(compressionStringSize).toStringUtf8(); remainingSize -= compressionStringSize; try { compression = HiveCompressionCodec.valueOf(compressionName); } catch (Exception e) { throw new PageFileCorruptionException("%s is invalid compression method in the footer of %s", compressionName, PAGEFILE.getInputFormat()); } int stripeCount = sliceInput.readInt(); remainingSize -= SIZE_OF_INT; if (remainingSize != SIZE_OF_LONG * stripeCount) { throw new PageFileCorruptionException("Malformed PageFile format, incorrect stripe count."); } for (int i = 0; i < stripeCount; ++i) { stripeOffsetsBuilder.add(sliceInput.readLong()); } } else { compression = null; } compressionCodec = Optional.ofNullable(compression); stripeOffsets = stripeOffsetsBuilder.build(); }</code><technical_language>else if (footerOffset > 0) { is needed</technical_language>

Target:
public PageFileFooterReader( FSDataInputStream inputStream, long fileSize) throws IOException { checkArgument(fileSize >= FOOTER_LENGTH_IN_BYTES, "Malformed PageFile format, footer length is missing."); requireNonNull(inputStream, "inputStream is null"); ImmutableList.Builder<Long> stripeOffsetsBuilder = ImmutableList.builder(); byte[] buffer = new byte[toIntExact(min(fileSize, ESTIMATED_FOOTER_SIZE))]; inputStream.readFully(fileSize - buffer.length, buffer); int footerSize = Slices.wrappedBuffer(buffer, buffer.length - FOOTER_LENGTH_IN_BYTES, FOOTER_LENGTH_IN_BYTES).getInt(0); footerOffset = fileSize - footerSize; HiveCompressionCodec compression; if (footerOffset < 0) { throw new PrestoException(HIVE_BAD_DATA, "Malformed PageFile format, incorrect footer length."); } else if (footerOffset > 0) { if (footerSize > buffer.length) { buffer = new byte[footerSize]; inputStream.readFully(footerOffset, buffer); } FixedLengthSliceInput sliceInput = Slices.wrappedBuffer(buffer, buffer.length - footerSize, footerSize - FOOTER_LENGTH_IN_BYTES).getInput(); long remainingSize = sliceInput.length(); int compressionStringSize = sliceInput.readInt(); remainingSize -= SIZE_OF_INT; String compressionName = sliceInput.readSlice(compressionStringSize).toStringUtf8(); remainingSize -= compressionStringSize; try { compression = HiveCompressionCodec.valueOf(compressionName); } catch (Exception e) { throw new PrestoException( HIVE_BAD_DATA, format("%s is invalid compression method in the footer of %s", compressionName, PAGEFILE.getInputFormat())); } int stripeCount = sliceInput.readInt(); remainingSize -= SIZE_OF_INT; if (remainingSize != SIZE_OF_LONG * stripeCount) { throw new PrestoException(HIVE_BAD_DATA, "Malformed PageFile format, incorrect stripe count."); } for (int i = 0; i < stripeCount; ++i) { stripeOffsetsBuilder.add(sliceInput.readLong()); } } else { compression = null; } compressionCodec = Optional.ofNullable(compression); stripeOffsets = stripeOffsetsBuilder.build(); }