Skip to content

Commit

Permalink
Client with Java 8 runtime and Apache HttpClient 5 Transport fails wi…
Browse files Browse the repository at this point in the history
…th java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer (#920)

Signed-off-by: Andriy Redko <[email protected]>
(cherry picked from commit 0db2215)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Apr 5, 2024
1 parent d5be3b0 commit 7d78a22
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fix integer overflow for variables in indices stats response ([#877](https://github.com/opensearch-project/opensearch-java/pull/877))
- Support weight function in function score query ([#880](https://github.com/opensearch-project/opensearch-java/pull/880))
- Fix pattern replace by making flag and replacement optional as on api ([#895](https://github.com/opensearch-project/opensearch-java/pull/895))
- Client with Java 8 runtime and Apache HttpClient 5 Transport fails with java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer ([#920](https://github.com/opensearch-project/opensearch-java/pull/920))

### Security

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
package org.opensearch.client.transport.httpclient5.internal;

import java.io.IOException;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
Expand Down Expand Up @@ -140,7 +141,7 @@ public void produce(final DataStreamChannel channel) throws IOException {
}
}
if (byteBuffer.position() > 0) {
byteBuffer.flip();
((Buffer) byteBuffer).flip();
channel.write(byteBuffer);
byteBuffer.compact();
}
Expand Down

0 comments on commit 7d78a22

Please sign in to comment.