This is an automated email from the ASF dual-hosted git repository. dkulp pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cxf.git
commit d89cfe4f6a52d133205af80fd363ecfdc85e41e5 Author: Daniel Kulp <dk...@apache.org> AuthorDate: Fri May 24 10:42:51 2019 -0400 Cast to Buffer to call flip so code compiled with Java11 will run on Java8 --- core/src/main/java/org/apache/cxf/common/util/UrlUtils.java | 3 ++- core/src/main/java/org/apache/cxf/io/ReaderInputStream.java | 13 +++++++------ .../http/asyncclient/CXFHttpAsyncRequestProducer.java | 3 ++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/org/apache/cxf/common/util/UrlUtils.java b/core/src/main/java/org/apache/cxf/common/util/UrlUtils.java index 1cd79d0..452f78b 100644 --- a/core/src/main/java/org/apache/cxf/common/util/UrlUtils.java +++ b/core/src/main/java/org/apache/cxf/common/util/UrlUtils.java @@ -21,6 +21,7 @@ package org.apache.cxf.common.util; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; +import java.nio.Buffer; import java.nio.BufferUnderflowException; import java.nio.ByteBuffer; import java.nio.charset.Charset; @@ -101,7 +102,7 @@ public final class UrlUtils { out.put((byte) b); } } - out.flip(); + ((Buffer)out).flip(); return Charset.forName(enc).decode(out).toString(); } return value; diff --git a/core/src/main/java/org/apache/cxf/io/ReaderInputStream.java b/core/src/main/java/org/apache/cxf/io/ReaderInputStream.java index dd4c533..6f0ced9 100644 --- a/core/src/main/java/org/apache/cxf/io/ReaderInputStream.java +++ b/core/src/main/java/org/apache/cxf/io/ReaderInputStream.java @@ -21,6 +21,7 @@ package org.apache.cxf.io; import java.io.IOException; import java.io.InputStream; import java.io.Reader; +import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.Charset; @@ -121,9 +122,9 @@ public class ReaderInputStream extends InputStream { this.reader = reader; this.encoder = encoder; this.encoderIn = CharBuffer.allocate(bufferSize); - this.encoderIn.flip(); + ((Buffer)this.encoderIn).flip(); this.encoderOut = ByteBuffer.allocate(128); - this.encoderOut.flip(); + ((Buffer)this.encoderOut).flip(); } /** @@ -193,7 +194,7 @@ public class ReaderInputStream extends InputStream { private void fillBuffer() throws IOException { if (!endOfInput && (lastCoderResult == null || lastCoderResult.isUnderflow())) { encoderIn.compact(); - int position = encoderIn.position(); + int position = ((Buffer)encoderIn).position(); // We don't use Reader#read(CharBuffer) here because it is more efficient // to write directly to the underlying char array (the default implementation // copies data to a temporary char array). @@ -201,13 +202,13 @@ public class ReaderInputStream extends InputStream { if (c == -1) { endOfInput = true; } else { - encoderIn.position(position + c); + ((Buffer)encoderIn).position(position + c); } - encoderIn.flip(); + ((Buffer)encoderIn).flip(); } encoderOut.compact(); lastCoderResult = encoder.encode(encoderIn, encoderOut, endOfInput); - encoderOut.flip(); + ((Buffer)encoderOut).flip(); } /** diff --git a/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFHttpAsyncRequestProducer.java b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFHttpAsyncRequestProducer.java index ecb4a3f..f78bbcf 100644 --- a/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFHttpAsyncRequestProducer.java +++ b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFHttpAsyncRequestProducer.java @@ -23,6 +23,7 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.net.URI; +import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.channels.Channels; import java.nio.channels.ReadableByteChannel; @@ -79,7 +80,7 @@ public class CXFHttpAsyncRequestProducer implements HttpAsyncRequestProducer { } } int i = -1; - buffer.rewind(); + ((Buffer)buffer).rewind(); if (buffer.hasRemaining() && chan != null) { i = chan.read(buffer); buffer.flip();