You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2020/07/17 16:49:42 UTC

[camel] 02/02: CAMEL-15309 - Camel 3.4.1 was built with JDK 11, use BufferCaster wherever needed

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

acosentino pushed a commit to branch camel-3.4.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 0ecd982afdc1e80388e195d25fe5275751ab0444
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Jul 17 18:42:09 2020 +0200

    CAMEL-15309 - Camel 3.4.1 was built with JDK 11, use BufferCaster wherever needed
---
 .../apache/camel/component/cxf/util/ReaderInputStream.java | 14 ++++++++------
 .../camel/builder/endpoint/StaticEndpointBuilders.java     |  8 ++++----
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/ReaderInputStream.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/ReaderInputStream.java
index c2890df..6726a24 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/ReaderInputStream.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/ReaderInputStream.java
@@ -26,6 +26,8 @@ import java.nio.charset.CharsetEncoder;
 import java.nio.charset.CoderResult;
 import java.nio.charset.CodingErrorAction;
 
+import static org.apache.camel.util.BufferCaster.cast;
+
 /**
  * {@link InputStream} implementation that reads a character stream from a {@link Reader}
  * and transforms it to a byte stream using a specified charset encoding. The stream
@@ -119,9 +121,9 @@ public class ReaderInputStream extends InputStream {
         this.reader = reader;
         this.encoder = encoder;
         this.encoderIn = CharBuffer.allocate(bufferSize);
-        this.encoderIn.flip();
+        cast(this.encoderIn).flip();
         this.encoderOut = ByteBuffer.allocate(128);
-        this.encoderOut.flip();
+        cast(this.encoderOut).flip();
     }
 
     /**
@@ -191,7 +193,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 = cast(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).
@@ -199,13 +201,13 @@ public class ReaderInputStream extends InputStream {
             if (c == -1) {
                 endOfInput = true;
             } else {
-                encoderIn.position(position + c);
+                cast(encoderIn).position(position + c);
             }
-            encoderIn.flip();
+            cast(encoderIn).flip();
         }
         encoderOut.compact();
         lastCoderResult = encoder.encode(encoderIn, encoderOut, endOfInput);
-        encoderOut.flip();
+        cast(encoderOut).flip();
     }
     
     /**
diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
index b1fbbcb..a1b155b 100644
--- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
+++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
@@ -3799,7 +3799,7 @@ public class StaticEndpointBuilders {
      * 
      * @param path beanId:address
      */
-    public static org.apache.camel.builder.endpoint.dsl.CxfEndpointBuilderFactory.CxfEndpointBuilder cxf(
+    static org.apache.camel.builder.endpoint.dsl.CxfEndpointBuilderFactory.CxfEndpointBuilder cxf(
             String path) {
         return org.apache.camel.builder.endpoint.dsl.CxfEndpointBuilderFactory.endpointBuilder("cxf", path);
     }
@@ -3824,7 +3824,7 @@ public class StaticEndpointBuilders {
      * instead of the default name
      * @param path beanId:address
      */
-    public static org.apache.camel.builder.endpoint.dsl.CxfEndpointBuilderFactory.CxfEndpointBuilder cxf(
+    static org.apache.camel.builder.endpoint.dsl.CxfEndpointBuilderFactory.CxfEndpointBuilder cxf(
             String componentName,
             String path) {
         return org.apache.camel.builder.endpoint.dsl.CxfEndpointBuilderFactory.endpointBuilder(componentName, path);
@@ -15314,7 +15314,7 @@ public class StaticEndpointBuilders {
      * 
      * @param path serverUrls/path
      */
-    static org.apache.camel.builder.endpoint.dsl.ZooKeeperEndpointBuilderFactory.ZooKeeperEndpointBuilder zookeeper(
+    public static org.apache.camel.builder.endpoint.dsl.ZooKeeperEndpointBuilderFactory.ZooKeeperEndpointBuilder zookeeper(
             String path) {
         return org.apache.camel.builder.endpoint.dsl.ZooKeeperEndpointBuilderFactory.endpointBuilder("zookeeper", path);
     }
@@ -15338,7 +15338,7 @@ public class StaticEndpointBuilders {
      * instead of the default name
      * @param path serverUrls/path
      */
-    static org.apache.camel.builder.endpoint.dsl.ZooKeeperEndpointBuilderFactory.ZooKeeperEndpointBuilder zookeeper(
+    public static org.apache.camel.builder.endpoint.dsl.ZooKeeperEndpointBuilderFactory.ZooKeeperEndpointBuilder zookeeper(
             String componentName,
             String path) {
         return org.apache.camel.builder.endpoint.dsl.ZooKeeperEndpointBuilderFactory.endpointBuilder(componentName, path);