This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch 3.2.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/3.2.x-fixes by this push:
     new 37db3c2  Cast to Buffer to call flip so code compiled with Java11 will 
run on Java8
37db3c2 is described below

commit 37db3c253b12cab90160f01857edda44cd592f7a
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
    
    (cherry picked from commit d89cfe4f6a52d133205af80fd363ecfdc85e41e5)
---
 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 6d65b12..f06da23 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;
@@ -105,7 +106,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();

Reply via email to