From 1d848641d76879573c02dafe9bd6941b794c29af Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Wed, 24 Feb 2021 07:40:32 -0800 Subject: [PATCH] Java client: ByteBuffer.clear supports higher JDK versions fix https://github.com/chrislusf/seaweedfs/issues/1836 --- .../src/main/java/seaweedfs/client/SeaweedOutputStream.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/other/java/client/src/main/java/seaweedfs/client/SeaweedOutputStream.java b/other/java/client/src/main/java/seaweedfs/client/SeaweedOutputStream.java index b73e99e69..ba298a713 100644 --- a/other/java/client/src/main/java/seaweedfs/client/SeaweedOutputStream.java +++ b/other/java/client/src/main/java/seaweedfs/client/SeaweedOutputStream.java @@ -8,6 +8,7 @@ import org.slf4j.LoggerFactory; import java.io.IOException; import java.io.InterruptedIOException; import java.io.OutputStream; +import java.nio.Buffer; import java.nio.ByteBuffer; import java.util.concurrent.*; @@ -217,7 +218,7 @@ public class SeaweedOutputStream extends OutputStream { private synchronized int submitWriteBufferToService(final ByteBuffer bufferToWrite, final long writePosition) throws IOException { - bufferToWrite.flip(); + ((Buffer)bufferToWrite).flip(); int bytesLength = bufferToWrite.limit() - bufferToWrite.position(); if (threadExecutor.getQueue().size() >= maxConcurrentRequestCount) {