Skip to content

HADOOP-19583. JDK8: RawLocalFileSystem calls ByteBuffer.flip #7725

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.io.OutputStream;
import java.io.FileDescriptor;
import java.net.URI;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.channels.AsynchronousFileChannel;
import java.nio.channels.CompletionHandler;
Expand Down Expand Up @@ -425,7 +426,7 @@ public void completed(Integer result, Integer rangeIndex) {
channel.read(buffer, range.getOffset() + buffer.position(), rangeIndex, this);
} else {
// Flip the buffer and declare success.
buffer.flip();
((Buffer)(buffer)).flip();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you use jdk17 build hadoop, and run on jdk8?
If so, you need check in all project like this, I think it has so many.

range.getData().complete(buffer);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.io.InputStream;
import java.io.InterruptedIOException;
import java.net.SocketTimeoutException;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -1029,7 +1030,7 @@ private void readSingleRange(FileRange range, ByteBuffer buffer) {
LOG.debug("Start reading {} from {} ", range, getPathStr());
if (range.getLength() == 0) {
// a zero byte read.
buffer.flip();
((Buffer)(buffer)).flip();
range.getData().complete(buffer);
return;
}
Expand Down Expand Up @@ -1092,7 +1093,7 @@ private void populateBuffer(FileRange range,
readByteArray(objectContent, range, tmp, offset, currentLength);
return null;
});
buffer.flip();
((Buffer)(buffer)).flip();
} else {
// there is no use of a temp byte buffer, or buffer.put() calls,
// so flip() is not needed.
Expand Down