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:40 UTC

[camel] branch camel-3.4.x updated (997f656 -> 0ecd982)

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

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


    from 997f656  CAMEL-15309 - Camel 3.4.1 was built with JDK 11, workaround the Bytebuffer problem by casting to Buffer when using the methods interested, camel-syslog
     new d9a2ff4  CAMEL-15309 - There the BufferCaster for this purpose, use it - camel-syslog
     new 0ecd982  CAMEL-15309 - Camel 3.4.1 was built with JDK 11, use BufferCaster wherever needed

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/camel/component/cxf/util/ReaderInputStream.java | 14 ++++++++------
 .../org/apache/camel/component/syslog/SyslogConverter.java |  5 +++--
 .../camel/builder/endpoint/StaticEndpointBuilders.java     |  8 ++++----
 3 files changed, 15 insertions(+), 12 deletions(-)


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

Posted by ac...@apache.org.
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);


[camel] 01/02: CAMEL-15309 - There the BufferCaster for this purpose, use it - camel-syslog

Posted by ac...@apache.org.
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 d9a2ff40ef70958042d0c6f12e48ff0c4b586327
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Jul 17 18:12:07 2020 +0200

    CAMEL-15309 - There the BufferCaster for this purpose, use it - camel-syslog
---
 .../main/java/org/apache/camel/component/syslog/SyslogConverter.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogConverter.java b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogConverter.java
index 85f3cab..b1e0a65 100644
--- a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogConverter.java
+++ b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogConverter.java
@@ -18,7 +18,6 @@ package org.apache.camel.component.syslog;
 
 import java.net.InetAddress;
 import java.net.UnknownHostException;
-import java.nio.Buffer;
 import java.nio.ByteBuffer;
 import java.util.Calendar;
 import java.util.GregorianCalendar;
@@ -31,6 +30,8 @@ import org.apache.camel.Converter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.camel.util.BufferCaster.cast;
+
 @Converter(generateLoader = true)
 public final class SyslogConverter {
 
@@ -136,7 +137,7 @@ public final class SyslogConverter {
     public static SyslogMessage parseMessage(byte[] bytes) {
         ByteBuffer byteBuffer = ByteBuffer.allocate(bytes.length);
         byteBuffer.put(bytes);
-        ((Buffer) byteBuffer).rewind();
+        cast(byteBuffer).rewind();
 
         Character charFound = (char) byteBuffer.get();