From issues-return-49513-archive-asf-public=cust-asf.ponee.io@camel.apache.org Thu Feb 15 17:25:05 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 6AF6718064A for ; Thu, 15 Feb 2018 17:25:05 +0100 (CET) Received: (qmail 23679 invoked by uid 500); 15 Feb 2018 16:25:04 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 23670 invoked by uid 99); 15 Feb 2018 16:25:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Feb 2018 16:25:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 0812CC10C8 for ; Thu, 15 Feb 2018 16:25:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.511 X-Spam-Level: X-Spam-Status: No, score=-109.511 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id xeVU3e2tjgz5 for ; Thu, 15 Feb 2018 16:25:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id C2CBC5F4AD for ; Thu, 15 Feb 2018 16:25:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 0EB27E0339 for ; Thu, 15 Feb 2018 16:25:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 5A3E421E63 for ; Thu, 15 Feb 2018 16:25:00 +0000 (UTC) Date: Thu, 15 Feb 2018 16:25:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CAMEL-12269) Bindy - Support regex expression as separator MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CAMEL-12269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16365832#comment-16365832 ] ASF GitHub Bot commented on CAMEL-12269: ---------------------------------------- oscerd commented on issue #2225: CAMEL-12269: Bindy - Support regex expression as separator URL: https://github.com/apache/camel/pull/2225#issuecomment-365980571 Is there any reason for these permissions change? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org > Bindy - Support regex expression as separator > --------------------------------------------- > > Key: CAMEL-12269 > URL: https://issues.apache.org/jira/browse/CAMEL-12269 > Project: Camel > Issue Type: New Feature > Components: camel-bindy > Affects Versions: 2.20.2 > Reporter: Bohdan > Priority: Major > > I try to unmarshal CSV file into the class below: > {code:java} > @CsvRecord(separator = "[,;]", skipFirstLine = true) > public class Example { > @DataField(pos = 1) > private String field1; > @DataField(pos = 2) > private String field2; > }{code} > CSV file: > {code:java} > header1,header2 > "value_1","value,2" > {code} > After unmarshalling I get the following value for field2: "value[,;]2". > However, the correct value for field2 should be "value,2". > Complete test: > {code:java} > import org.apache.camel.builder.RouteBuilder; > import org.apache.camel.component.mock.MockEndpoint; > import org.apache.camel.dataformat.bindy.annotation.CsvRecord; > import org.apache.camel.dataformat.bindy.annotation.DataField; > import org.apache.camel.model.dataformat.BindyType; > import org.apache.camel.test.junit4.CamelTestSupport; > import org.junit.Test; > public class BindyTest extends CamelTestSupport { > @CsvRecord(separator = "[,;]", skipFirstLine = true) > public static class Example { > @DataField(pos = 1) > private String field1; > @DataField(pos = 2) > private String field2; > } > @Test > public void testUnmarshal() throws Exception { > MockEndpoint mock = getMockEndpoint("mock:result"); > mock.expectedMessageCount(1); > template.sendBody("direct:unmarshal", "header1,header2\n\"value1\",\"value,2\""); > assertMockEndpointsSatisfied(); > Example body = mock.getReceivedExchanges().get(0).getIn().getBody(Example.class); > assertEquals("value,2", body.field2); > } > @Override > protected RouteBuilder createRouteBuilder() throws Exception { > return new RouteBuilder() { > @Override > public void configure() throws Exception { > from("direct:unmarshal") > .unmarshal().bindy(BindyType.Csv, Example.class) > .to("mock:result"); > } > }; > } > } > {code} > *Possible workaround:* > Use separator {code}"[,;](?=(?:[^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)"{code} (regex explained in https://stackoverflow.com/a/18893443) -- This message was sent by Atlassian JIRA (v7.6.3#76005)