arshid dar
arshid dar

Reputation: 1485

how to allow shorter lines in camel univocity fixed parser?

i have file like this

12345678
12345678
123

i have set two headers on UniVocityFixedWidthDataFormat with names num1 and num2 with length 5 and 3. the parser is able to read first two lines with ease, but it throws null pointer exception at third line. how can i tell my parser to read the shorter lines as well.

here is the stacktrace

java.lang.NullPointerException: null
    at org.apache.camel.dataformat.univocity.Unmarshaller$MapRowIterator.convertRow(Unmarshaller.java:189) ~[camel-univocity-parsers-2.24.2.jar:2.24.2]
    at org.apache.camel.dataformat.univocity.Unmarshaller$MapRowIterator.convertRow(Unmarshaller.java:168) ~[camel-univocity-parsers-2.24.2.jar:2.24.2]
    at org.apache.camel.dataformat.univocity.Unmarshaller$RowIterator.next(Unmarshaller.java:117) ~[camel-univocity-parsers-2.24.2.jar:2.24.2]
    at org.apache.camel.processor.Splitter$SplitterIterable$1.next(Splitter.java:203) ~[camel-core-2.24.2.jar:2.24.2]
    at org.apache.camel.processor.Splitter$SplitterIterable$1.next(Splitter.java:179) ~[camel-core-2.24.2.jar:2.24.2]
    at org.apache.camel.processor.MulticastProcessor.doProcessParallel(MulticastProcessor.java:307) ~[camel-core-2.24.2.jar:2.24.2]
    at org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:246) ~[camel-core-2.24.2.jar:2.24.2]
    at org.apache.camel.processor.Splitter.process(Splitter.java:129) ~[camel-core-2.24.2.jar:2.24.2]
    at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548) [camel-core-2.24.2.jar:2.24.2]
    at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) [camel-core-2.24.2.jar:2.24.2]
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:138) [camel-core-2.24.2.jar:2.24.2]
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:101) [camel-core-2.24.2.jar:2.24.2]
    at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) [camel-core-2.24.2.jar:2.24.2]
    at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:454) [camel-core-2.24.2.jar:2.24.2]
    at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:223) [camel-core-2.24.2.jar:2.24.2]
    at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:187) [camel-core-2.24.2.jar:2.24.2]
    at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174) [camel-core-2.24.2.jar:2.24.2]
    at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101) [camel-core-2.24.2.jar:2.24.2]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_211]
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:1.8.0_211]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_211]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_211]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_211]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_211]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_211]

Upvotes: 0

Views: 81

Answers (0)

Related Questions