From 635081df36990b8d5a4ed53564d31c67f11339b0 Mon Sep 17 00:00:00 2001 From: Andriy Redko Date: Fri, 5 Apr 2024 08:49:19 -0400 Subject: [PATCH] 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 --- .../httpclient5/internal/HttpEntityAsyncEntityProducer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java-client/src/main/java/org/opensearch/client/transport/httpclient5/internal/HttpEntityAsyncEntityProducer.java b/java-client/src/main/java/org/opensearch/client/transport/httpclient5/internal/HttpEntityAsyncEntityProducer.java index 2713f6182a..e06d0a0ee2 100644 --- a/java-client/src/main/java/org/opensearch/client/transport/httpclient5/internal/HttpEntityAsyncEntityProducer.java +++ b/java-client/src/main/java/org/opensearch/client/transport/httpclient5/internal/HttpEntityAsyncEntityProducer.java @@ -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; @@ -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(); }