camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (CAMEL-11065) Cannot parse CSV record starting with separator character
Date Sun, 09 Apr 2017 08:27:41 GMT

     [ https://issues.apache.org/jira/browse/CAMEL-11065?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Claus Ibsen resolved CAMEL-11065.
---------------------------------
    Resolution: Fixed
      Assignee: Claus Ibsen

Thanks the PR has been merged

> Cannot parse CSV record starting with separator character
> ---------------------------------------------------------
>
>                 Key: CAMEL-11065
>                 URL: https://issues.apache.org/jira/browse/CAMEL-11065
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-bindy
>    Affects Versions: 2.18.3
>            Reporter: Tomáš Livora
>            Assignee: Claus Ibsen
>             Fix For: 2.18.4, 2.19.0
>
>
> Camel Bindy is not able to parse a CSV file where one value starts with a separator character.
Example of such a record:
> {code}
> 'text1',',text2',3
> {code}
> And the Java class used:
> {code:title=Bar.java|borderStyle=solid}
> @CsvRecord(separator = ",", quote = "'")
> public class Record {
>     @DataField(pos = 1)
>     private String text1;
>     @DataField(pos = 2)
>     private String text2;
>     @DataField(pos = 3, pattern = "########.##")
>     private BigDecimal number;
> }
> {code}
> You will get an exception like this:
> {code}
> java.lang.IllegalArgumentException: Parsing error detected for field defined at the position:
3, line: 1
> 	at org.apache.camel.dataformat.bindy.BindyCsvFactory.bind(BindyCsvFactory.java:213)
> 	at org.apache.camel.dataformat.bindy.csv.BindyCsvDataFormat.unmarshal(BindyCsvDataFormat.java:173)
> 	at org.apache.camel.processor.UnmarshalProcessor.process(UnmarshalProcessor.java:69)
> 	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
> 	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)
> 	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
> 	at org.apache.camel.processor.Pipeline.process(Pipeline.java:120)
> 	at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
> 	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
> 	at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)
> 	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)
> 	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
> 	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)
> 	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
> 	at org.apache.camel.processor.Pipeline.process(Pipeline.java:120)
> 	at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
> 	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)
> 	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
> 	at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:681)
> 	at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:609)
> 	at org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:238)
> 	at org.apache.camel.processor.Splitter.process(Splitter.java:108)
> 	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
> 	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)
> 	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
> 	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
> 	at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:460)
> 	at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:227)
> 	at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:191)
> 	at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175)
> 	at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102)
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> 	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
> 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
> 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> 	at java.lang.Thread.run(Thread.java:745)
> Caused by: java.lang.NumberFormatException: null
> 	at java.math.BigDecimal.<init>(BigDecimal.java:494)
> 	at java.math.BigDecimal.<init>(BigDecimal.java:383)
> 	at java.math.BigDecimal.<init>(BigDecimal.java:806)
> 	at org.apache.camel.dataformat.bindy.format.factories.BigDecimalPatternFormatFactory$BigDecimalPatternFormat.parse(BigDecimalPatternFormatFactory.java:66)
> 	at org.apache.camel.dataformat.bindy.format.factories.BigDecimalPatternFormatFactory$BigDecimalPatternFormat.parse(BigDecimalPatternFormatFactory.java:49)
> 	at org.apache.camel.dataformat.bindy.BindyCsvFactory.bind(BindyCsvFactory.java:209)
> 	... 37 common frames omitted
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message