You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by on...@apache.org on 2018/10/05 22:52:19 UTC
[camel] 02/02: CAMEL-12698 - conflict resolution after merging #2454
This is an automated email from the ASF dual-hosted git repository.
onders pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 40177ebcc76307c6f65035ac6735ff405205249b
Author: onders <on...@apache.org>
AuthorDate: Sat Oct 6 01:04:48 2018 +0300
CAMEL-12698 - conflict resolution after merging #2454
---
.../apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
index 4f1c927..12f438b 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
@@ -156,7 +156,7 @@ public class BindyCsvDataFormat extends BindyAbstractDataFormat {
String separator = factory.getSeparator();
String quote = factory.getQuote();
ObjectHelper.notNull(separator, "The separator has not been defined in the annotation @CsvRecord or not instantiated during initModel.");
-
+ Boolean removeQuotes = factory.getRemoveQuotes();
AtomicInteger count = new AtomicInteger(0);
// Use a Stream to stream a file across.
@@ -173,7 +173,7 @@ public class BindyCsvDataFormat extends BindyAbstractDataFormat {
// If the internals of the consumer fail, we unrap the checked exception upstream.
try {
lines.skip(linesToSkip)
- .forEachOrdered(consumeFile(factory, models, separator, quote, count));
+ .forEachOrdered(consumeFile(factory, models, separator, removeQuotes, quote, count));
} catch (WrappedException e) {
throw e.getWrappedException();
}
@@ -195,7 +195,7 @@ public class BindyCsvDataFormat extends BindyAbstractDataFormat {
}
private Consumer<String> consumeFile(BindyCsvFactory factory, List<Map<String, Object>> models,
- String separator, String quote, AtomicInteger count) {
+ String separator, Boolean removeQuotes, String quote, AtomicInteger count) {
return line -> {
try {
// Trim the line coming in to remove any trailing whitespace
@@ -227,8 +227,9 @@ public class BindyCsvDataFormat extends BindyAbstractDataFormat {
List<String> result = Arrays.asList(tokens);
// must unquote tokens before use
-
- result = unquoteTokens(result, separators, quote);
+ if (removeQuotes) {
+ result = unquoteTokens(result, separators, quote);
+ }
if (result.isEmpty()) {
throw new IllegalArgumentException("No records have been defined in the CSV");