camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tomáš Livora (JIRA) <j...@apache.org>
Subject [jira] [Created] (CAMEL-11065) Cannot parse CSV record starting with separator character
Date Fri, 24 Mar 2017 16:37:41 GMT
Tomáš Livora created CAMEL-11065:
------------------------------------

             Summary: 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


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