[ 
https://issues.apache.org/jira/browse/CAMEL-13597?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16850946#comment-16850946
 ] 

qu4ntic edited comment on CAMEL-13597 at 5/29/19 3:13 PM:
----------------------------------------------------------

{{I tested with version {color:#ff0000}2.23.2{color} and unfortunately this 
still doesn't work.}}
{code:java}
.split().tokenize("\r\n|\n", true, 2, true)
 .streaming()
 // Add the csv header on each chunk
 .process(exchange -> {
 String headerString = exchange.getIn().getHeader(CSV_HEADER, String.class);
 exchange.getIn().setBody(headerString + "\n" + exchange.getIn().getBody());
 }){code}
should return chunks of 2 rows along with the csv header, however it returns 
the two rows with an additional row in-between having a "|" :

Should be :
{code:java}
2019-05-29 17:01:41 INFO d66205be-9ea5-4d49-a341-cb9235cb0d8a | Input message 
body : 
header
row1
row2{code}
but I get :
{code:java}
2019-05-29 17:01:41 INFO d66205be-9ea5-4d49-a341-cb9235cb0d8a | Input message 
body : 
header
row1
|
row2{code}
 


was (Author: justqu4ntic):
{{I tested with version {color:#FF0000}2.23.2{color} and unfortunately this 
still doesn't work.}}
{code:java}
.split().tokenize("\r\n|\n", true, 2, true)
 .streaming()
 // Add the csv header on each chunk
 .process(exchange -> {
 String headerString = exchange.getIn().getHeader(CSV_HEADER, String.class);
 exchange.getIn().setBody(headerString + "\n" + exchange.getIn().getBody());
 }){code}
should return chunks of 2 rows along with the csv header, however it returns 
the two rows with an additional row having a "|" :

Should be :
{code:java}
2019-05-29 17:01:41 INFO d66205be-9ea5-4d49-a341-cb9235cb0d8a | Input message 
body : 
header
row1
row2{code}
but I get :
{code:java}
2019-05-29 17:01:41 INFO d66205be-9ea5-4d49-a341-cb9235cb0d8a | Input message 
body : 
header
row1
|
row2{code}
 

> Splitter tokenize doesn't really accept every regex
> ---------------------------------------------------
>
>                 Key: CAMEL-13597
>                 URL: https://issues.apache.org/jira/browse/CAMEL-13597
>             Project: Camel
>          Issue Type: Bug
>          Components: came-core
>    Affects Versions: 2.17.0
>            Reporter: qu4ntic
>            Priority: Minor
>              Labels: bug
>
> Hi, 
> Neither
> {code:java}
> .split().tokenize("\r?\n", true, 2, true){code}
> nor 
> {code:java}
> .split().tokenize("\r\n|\n", true, 2, true){code}
> work.
>  
> The latter expression insert a "|" instead of correctly split rows on \r\n or 
> \n.
>  
>  
>  
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to