You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/08/25 05:36:11 UTC

[camel] 03/03: camel-csv should not use reflection for ordered. Some minor dependency upgrades.

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

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 1c9c3a31b7a854a6a8b578beecfb95dca81e1b68
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Aug 25 07:35:36 2020 +0200

    camel-csv should not use reflection for ordered. Some minor dependency upgrades.
---
 camel-dependencies/pom.xml                         | 14 +++++++-------
 .../camel/dataformat/csv/CsvRecordConverters.java  | 22 +---------------------
 parent/pom.xml                                     |  6 +++---
 3 files changed, 11 insertions(+), 31 deletions(-)

diff --git a/camel-dependencies/pom.xml b/camel-dependencies/pom.xml
index 0111210..ac0cedd 100644
--- a/camel-dependencies/pom.xml
+++ b/camel-dependencies/pom.xml
@@ -130,10 +130,10 @@
     <commons-codec-version>1.14</commons-codec-version>
     <commons-collections-version>3.2.2</commons-collections-version>
     <commons-collections4-version>4.4</commons-collections4-version>
-    <commons-compress-version>1.19</commons-compress-version>
+    <commons-compress-version>1.20</commons-compress-version>
     <commons-configuration-version>1.9</commons-configuration-version>
     <commons-configuration2-version>2.7</commons-configuration2-version>
-    <commons-csv-version>1.6</commons-csv-version>
+    <commons-csv-version>1.8</commons-csv-version>
     <commons-dbcp-version>1.4</commons-dbcp-version>
     <commons-dbcp2-version>2.7.0</commons-dbcp2-version>
     <commons-exec-version>1.3</commons-exec-version>
@@ -150,11 +150,11 @@
     <compiler.fork>true</compiler.fork>
     <compress-lzf-version>1.0.4</compress-lzf-version>
     <conscrypt-uber-version>2.2.1</conscrypt-uber-version>
-    <consul-client-version>1.3.3</consul-client-version>
-    <corda-version>4.4</corda-version>
-    <couchbase-client-version>3.0.6</couchbase-client-version>
+    <consul-client-version>1.4.2</consul-client-version>
+    <corda-version>4.5</corda-version>
+    <couchbase-client-version>3.0.7</couchbase-client-version>
     <curator-version>4.3.0</curator-version>
-    <cxf-codegen-plugin-version>3.3.5</cxf-codegen-plugin-version>
+    <cxf-codegen-plugin-version>3.4.0</cxf-codegen-plugin-version>
     <cxf-version>3.4.0</cxf-version>
     <cxf-version-range>[3.3,4.0)</cxf-version-range>
     <cxf-xjc-plugin-version>3.3.1</cxf-xjc-plugin-version>
@@ -164,7 +164,7 @@
     <cxf.xjc.jvmArgs></cxf.xjc.jvmArgs>
     <debezium-mysql-connector-version>8.0.16</debezium-mysql-connector-version>
     <debezium-version>1.2.1.Final</debezium-version>
-    <deltaspike-version>1.9.0</deltaspike-version>
+    <deltaspike-version>1.9.4</deltaspike-version>
     <depends-maven-plugin-version>1.4.0</depends-maven-plugin-version>
     <derby-version>10.14.2.0</derby-version>
     <digitalocean-api-client-version>2.17</digitalocean-api-client-version>
diff --git a/components/camel-csv/src/main/java/org/apache/camel/dataformat/csv/CsvRecordConverters.java b/components/camel-csv/src/main/java/org/apache/camel/dataformat/csv/CsvRecordConverters.java
index f3b4fbb..cb7cc41 100644
--- a/components/camel-csv/src/main/java/org/apache/camel/dataformat/csv/CsvRecordConverters.java
+++ b/components/camel-csv/src/main/java/org/apache/camel/dataformat/csv/CsvRecordConverters.java
@@ -16,9 +16,7 @@
  */
 package org.apache.camel.dataformat.csv;
 
-import java.lang.reflect.Field;
 import java.util.ArrayList;
-import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -89,25 +87,7 @@ final class CsvRecordConverters {
         @Override
         @SuppressWarnings("unchecked")
         public Map<String, String> convertRecord(CSVRecord record) {
-            Map<String, String> answer = new LinkedHashMap<>();
-
-            // use reflection because CSVRecord does not return maps ordered
-            try {
-                Field field = record.getClass().getDeclaredField("mapping");
-                field.setAccessible(true);
-                Map<String, Integer> mapping = (Map<String, Integer>) field.get(record);
-                if (mapping != null) {
-                    for (Object o : mapping.entrySet()) {
-                        Map.Entry<String, Integer> entry = (Map.Entry) o;
-                        int col = entry.getValue();
-                        answer.put(entry.getKey(), record.get(col));
-                    }
-                }
-            } catch (Exception e) {
-                e.printStackTrace();
-                // ignore
-            }
-            return answer;
+            return record.toMap();
         }
     }
 }
diff --git a/parent/pom.xml b/parent/pom.xml
index 8c7b9f0..0d22b16 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -115,7 +115,7 @@
         <commons-compress-version>1.19</commons-compress-version>
         <commons-configuration-version>1.9</commons-configuration-version>
         <commons-configuration2-version>2.7</commons-configuration2-version>
-        <commons-csv-version>1.6</commons-csv-version>
+        <commons-csv-version>1.8</commons-csv-version>
         <commons-cli-version>1.4</commons-cli-version>
         <commons-dbcp-version>1.4</commons-dbcp-version>
         <commons-dbcp2-version>2.7.0</commons-dbcp2-version>
@@ -134,7 +134,7 @@
         <conscrypt-uber-version>2.2.1</conscrypt-uber-version>
         <consul-client-version>1.3.3</consul-client-version>
         <cobertura-maven-plugin-version>2.7</cobertura-maven-plugin-version>
-        <corda-version>4.4</corda-version>
+        <corda-version>4.5</corda-version>
         <couchbase-client-version>3.0.6</couchbase-client-version>
         <curator-version>4.3.0</curator-version>
         <cxf-version>3.4.0</cxf-version>
@@ -143,7 +143,7 @@
         <!-- cxf-xjc is not released as often -->
         <cxf-xjc-plugin-version>3.3.1</cxf-xjc-plugin-version>
         <cxf-xjc-utils-version>3.3.1</cxf-xjc-utils-version>
-        <deltaspike-version>1.9.0</deltaspike-version>
+        <deltaspike-version>1.9.4</deltaspike-version>
         <depends-maven-plugin-version>1.4.0</depends-maven-plugin-version>
         <derby-version>10.14.2.0</derby-version>
         <digitalocean-api-client-version>2.17</digitalocean-api-client-version>


Re: [camel] 03/03: camel-csv should not use reflection for ordered. Some minor dependency upgrades.

Posted by Andrea Cosentino <an...@gmail.com>.
commons-compress 1.20 will break tar component if I remember correctly,
corda 4.5 won't work.

Il giorno mar 25 ago 2020 alle ore 07:36 <da...@apache.org> ha scritto:

> This is an automated email from the ASF dual-hosted git repository.
>
> davsclaus pushed a commit to branch master
> in repository https://gitbox.apache.org/repos/asf/camel.git
>
> commit 1c9c3a31b7a854a6a8b578beecfb95dca81e1b68
> Author: Claus Ibsen <cl...@gmail.com>
> AuthorDate: Tue Aug 25 07:35:36 2020 +0200
>
>     camel-csv should not use reflection for ordered. Some minor dependency
> upgrades.
> ---
>  camel-dependencies/pom.xml                         | 14 +++++++-------
>  .../camel/dataformat/csv/CsvRecordConverters.java  | 22
> +---------------------
>  parent/pom.xml                                     |  6 +++---
>  3 files changed, 11 insertions(+), 31 deletions(-)
>
> diff --git a/camel-dependencies/pom.xml b/camel-dependencies/pom.xml
> index 0111210..ac0cedd 100644
> --- a/camel-dependencies/pom.xml
> +++ b/camel-dependencies/pom.xml
> @@ -130,10 +130,10 @@
>      <commons-codec-version>1.14</commons-codec-version>
>      <commons-collections-version>3.2.2</commons-collections-version>
>      <commons-collections4-version>4.4</commons-collections4-version>
> -    <commons-compress-version>1.19</commons-compress-version>
> +    <commons-compress-version>1.20</commons-compress-version>
>      <commons-configuration-version>1.9</commons-configuration-version>
>      <commons-configuration2-version>2.7</commons-configuration2-version>
> -    <commons-csv-version>1.6</commons-csv-version>
> +    <commons-csv-version>1.8</commons-csv-version>
>      <commons-dbcp-version>1.4</commons-dbcp-version>
>      <commons-dbcp2-version>2.7.0</commons-dbcp2-version>
>      <commons-exec-version>1.3</commons-exec-version>
> @@ -150,11 +150,11 @@
>      <compiler.fork>true</compiler.fork>
>      <compress-lzf-version>1.0.4</compress-lzf-version>
>      <conscrypt-uber-version>2.2.1</conscrypt-uber-version>
> -    <consul-client-version>1.3.3</consul-client-version>
> -    <corda-version>4.4</corda-version>
> -    <couchbase-client-version>3.0.6</couchbase-client-version>
> +    <consul-client-version>1.4.2</consul-client-version>
> +    <corda-version>4.5</corda-version>
> +    <couchbase-client-version>3.0.7</couchbase-client-version>
>      <curator-version>4.3.0</curator-version>
> -    <cxf-codegen-plugin-version>3.3.5</cxf-codegen-plugin-version>
> +    <cxf-codegen-plugin-version>3.4.0</cxf-codegen-plugin-version>
>      <cxf-version>3.4.0</cxf-version>
>      <cxf-version-range>[3.3,4.0)</cxf-version-range>
>      <cxf-xjc-plugin-version>3.3.1</cxf-xjc-plugin-version>
> @@ -164,7 +164,7 @@
>      <cxf.xjc.jvmArgs></cxf.xjc.jvmArgs>
>
>  <debezium-mysql-connector-version>8.0.16</debezium-mysql-connector-version>
>      <debezium-version>1.2.1.Final</debezium-version>
> -    <deltaspike-version>1.9.0</deltaspike-version>
> +    <deltaspike-version>1.9.4</deltaspike-version>
>      <depends-maven-plugin-version>1.4.0</depends-maven-plugin-version>
>      <derby-version>10.14.2.0</derby-version>
>
>  <digitalocean-api-client-version>2.17</digitalocean-api-client-version>
> diff --git
> a/components/camel-csv/src/main/java/org/apache/camel/dataformat/csv/CsvRecordConverters.java
> b/components/camel-csv/src/main/java/org/apache/camel/dataformat/csv/CsvRecordConverters.java
> index f3b4fbb..cb7cc41 100644
> ---
> a/components/camel-csv/src/main/java/org/apache/camel/dataformat/csv/CsvRecordConverters.java
> +++
> b/components/camel-csv/src/main/java/org/apache/camel/dataformat/csv/CsvRecordConverters.java
> @@ -16,9 +16,7 @@
>   */
>  package org.apache.camel.dataformat.csv;
>
> -import java.lang.reflect.Field;
>  import java.util.ArrayList;
> -import java.util.LinkedHashMap;
>  import java.util.List;
>  import java.util.Map;
>
> @@ -89,25 +87,7 @@ final class CsvRecordConverters {
>          @Override
>          @SuppressWarnings("unchecked")
>          public Map<String, String> convertRecord(CSVRecord record) {
> -            Map<String, String> answer = new LinkedHashMap<>();
> -
> -            // use reflection because CSVRecord does not return maps
> ordered
> -            try {
> -                Field field =
> record.getClass().getDeclaredField("mapping");
> -                field.setAccessible(true);
> -                Map<String, Integer> mapping = (Map<String, Integer>)
> field.get(record);
> -                if (mapping != null) {
> -                    for (Object o : mapping.entrySet()) {
> -                        Map.Entry<String, Integer> entry = (Map.Entry) o;
> -                        int col = entry.getValue();
> -                        answer.put(entry.getKey(), record.get(col));
> -                    }
> -                }
> -            } catch (Exception e) {
> -                e.printStackTrace();
> -                // ignore
> -            }
> -            return answer;
> +            return record.toMap();
>          }
>      }
>  }
> diff --git a/parent/pom.xml b/parent/pom.xml
> index 8c7b9f0..0d22b16 100644
> --- a/parent/pom.xml
> +++ b/parent/pom.xml
> @@ -115,7 +115,7 @@
>          <commons-compress-version>1.19</commons-compress-version>
>          <commons-configuration-version>1.9</commons-configuration-version>
>
>  <commons-configuration2-version>2.7</commons-configuration2-version>
> -        <commons-csv-version>1.6</commons-csv-version>
> +        <commons-csv-version>1.8</commons-csv-version>
>          <commons-cli-version>1.4</commons-cli-version>
>          <commons-dbcp-version>1.4</commons-dbcp-version>
>          <commons-dbcp2-version>2.7.0</commons-dbcp2-version>
> @@ -134,7 +134,7 @@
>          <conscrypt-uber-version>2.2.1</conscrypt-uber-version>
>          <consul-client-version>1.3.3</consul-client-version>
>
>  <cobertura-maven-plugin-version>2.7</cobertura-maven-plugin-version>
> -        <corda-version>4.4</corda-version>
> +        <corda-version>4.5</corda-version>
>          <couchbase-client-version>3.0.6</couchbase-client-version>
>          <curator-version>4.3.0</curator-version>
>          <cxf-version>3.4.0</cxf-version>
> @@ -143,7 +143,7 @@
>          <!-- cxf-xjc is not released as often -->
>          <cxf-xjc-plugin-version>3.3.1</cxf-xjc-plugin-version>
>          <cxf-xjc-utils-version>3.3.1</cxf-xjc-utils-version>
> -        <deltaspike-version>1.9.0</deltaspike-version>
> +        <deltaspike-version>1.9.4</deltaspike-version>
>          <depends-maven-plugin-version>1.4.0</depends-maven-plugin-version>
>          <derby-version>10.14.2.0</derby-version>
>
>  <digitalocean-api-client-version>2.17</digitalocean-api-client-version>
>
>