Skip to content

Commit 635081d

Browse files
committed
Client with Java 8 runtime and Apache HttpClient 5 Transport fails with java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer
Signed-off-by: Andriy Redko <[email protected]>
1 parent 766b6ec commit 635081d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

java-client/src/main/java/org/opensearch/client/transport/httpclient5/internal/HttpEntityAsyncEntityProducer.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
package org.opensearch.client.transport.httpclient5.internal;
1010

1111
import java.io.IOException;
12+
import java.nio.Buffer;
1213
import java.nio.ByteBuffer;
1314
import java.nio.channels.Channels;
1415
import java.nio.channels.ReadableByteChannel;
@@ -140,7 +141,7 @@ public void produce(final DataStreamChannel channel) throws IOException {
140141
}
141142
}
142143
if (byteBuffer.position() > 0) {
143-
byteBuffer.flip();
144+
((Buffer)byteBuffer).flip();
144145
channel.write(byteBuffer);
145146
byteBuffer.compact();
146147
}

0 commit comments

Comments
 (0)