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]>
  • Loading branch information
reta authored Apr 5, 2024
1 parent 766b6ec commit 0db2215
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 @@ -54,6 +54,7 @@ This section is for maintaining a changelog for all breaking changes for the cli
- 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 0db2215

Please sign in to comment.