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
The following commit(s) were added to refs/heads/master by this push: new 2ce57ac CAMEL-15920 - removed trailing tabs trimming for tab separator (#4730) 2ce57ac is described below commit 2ce57ac2dd99923e2f2e7328be0a605dc9ccd9d8 Author: anestoruk <and.nesto...@gmail.com> AuthorDate: Mon Dec 7 07:08:16 2020 +0100 CAMEL-15920 - removed trailing tabs trimming for tab separator (#4730) --- .../apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java | 2 +- .../camel/dataformat/bindy/csv/BindyTabSeparatorTest.java | 10 ++++++---- 2 files changed, 7 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 d7adc69..416a177 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 @@ -206,7 +206,7 @@ public class BindyCsvDataFormat extends BindyAbstractDataFormat { // if separator is a tab, don't trim any leading whitespaces (could be empty values separated by tabs) if (separator.equals("\t")) { // trim only trailing whitespaces - trimmedLine = line.replaceAll("\\s+$", ""); + trimmedLine = line.replaceAll("[ \\n\\x0B\\f\\r]+$", ""); } else { trimmedLine = line.trim(); } diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyTabSeparatorTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyTabSeparatorTest.java index c517cb4..91fcc45 100644 --- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyTabSeparatorTest.java +++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyTabSeparatorTest.java @@ -74,8 +74,10 @@ public class BindyTabSeparatorTest extends CamelTestSupport { mock.expectedMessageCount(1); template.sendBodyAndHeader("direct:unmarshal", - "123\tCamel in Action\t2\t\t\n456\tCamel in Action\t1\t\t\t\n" - + "456\tCamel in Action\t2\t\t\n456\tCamel in Action\t1\t\t\t\n", + "123\tCamel in Action\t2\t\t\n" + + "456\tCamel in Action\t1\t\t\t\n" + + "456\tCamel in Action\t2\t\t\n" + + "456\tCamel in Action\t1\t\t\t\n", Exchange.CONTENT_ENCODING, "iso8859-1"); assertMockEndpointsSatisfied(); @@ -86,8 +88,8 @@ public class BindyTabSeparatorTest extends CamelTestSupport { assertEquals(123, order.getId()); assertEquals("Camel in Action", order.getName()); assertEquals(2, order.getAmount()); - assertNull(order.getOrderText()); - assertNull(order.getSalesRef()); + assertEquals("", order.getOrderText()); + assertEquals("", order.getSalesRef()); assertNull(order.getCustomerRef()); }