[ https://issues.apache.org/jira/browse/CAMEL-13737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16881389#comment-16881389 ]
michael elbaz commented on CAMEL-13737: --------------------------------------- I add the project you just have to specify the input directory path in file component and run the main class > [AVRO] java.lang.ArrayIndexOutOfBoundsException: -40 > ---------------------------------------------------- > > Key: CAMEL-13737 > URL: https://issues.apache.org/jira/browse/CAMEL-13737 > Project: Camel > Issue Type: Bug > Components: camel-avro > Affects Versions: 2.24.1 > Reporter: michael elbaz > Priority: Minor > Attachments: avro1.avro, packages.zip, test-avro-project.zip > > > When i try to deserialize some avro file like provided i got > java.lang.ArrayIndexOutOfBoundsException: -40, i also didn't understand the > camel component it doesn't put the schema in the generated avro file it > should not ? > The route: > {code:java} > public class AvroRoute extends RouteBuilder { > @Override > public void configure() throws Exception { > from("file:<path>?noop=true&delay=30000&initialDelay=0") > > .unmarshal().avro("referential.product.v2.NationalSalePricesBV1") > ; > } > } > {code} > The stackTrace: > {code:java} > Message History > --------------------------------------------------------------------------------------------------------------------------------------- > RouteId ProcessorId Processor > Elapsed (ms) > [route1 ] [route1 ] > [file://D:/java/tests/avro/src/main/resources/in?delay=30000&initialDelay=0&noo] > [ 34] > [route1 ] [unmarshal1 ] > [unmarshal[org.apache.camel.model.dataformat.AvroDataFormat@2394b9c7] > ] [ 30] > Stacktrace > --------------------------------------------------------------------------------------------------------------------------------------- > java.lang.ArrayIndexOutOfBoundsException: -40 > at > org.apache.avro.io.parsing.Symbol$Alternative.getSymbol(Symbol.java:424) > ~[avro-1.8.2.jar:1.8.2] > at > org.apache.avro.io.ResolvingDecoder.doAction(ResolvingDecoder.java:290) > ~[avro-1.8.2.jar:1.8.2] > at org.apache.avro.io.parsing.Parser.advance(Parser.java:88) > ~[avro-1.8.2.jar:1.8.2] > at > org.apache.avro.io.ResolvingDecoder.readIndex(ResolvingDecoder.java:267) > ~[avro-1.8.2.jar:1.8.2] > at > org.apache.avro.generic.GenericDatumReader.readWithoutConversion(GenericDatumReader.java:179) > ~[avro-1.8.2.jar:1.8.2] > at > org.apache.avro.specific.SpecificDatumReader.readField(SpecificDatumReader.java:116) > ~[avro-1.8.2.jar:1.8.2] > at > org.apache.avro.generic.GenericDatumReader.readRecord(GenericDatumReader.java:222) > ~[avro-1.8.2.jar:1.8.2] > at > org.apache.avro.generic.GenericDatumReader.readWithoutConversion(GenericDatumReader.java:175) > ~[avro-1.8.2.jar:1.8.2] > at > org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:153) > ~[avro-1.8.2.jar:1.8.2] > at > org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:145) > ~[avro-1.8.2.jar:1.8.2] > at > org.apache.camel.dataformat.avro.AvroDataFormat.unmarshal(AvroDataFormat.java:148) > ~[camel-avro-2.23.0.jar:2.23.0] > at > org.apache.camel.processor.UnmarshalProcessor.process(UnmarshalProcessor.java:69) > ~[camel-core-2.23.0.jar:2.23.0] > at > org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548) > ~[camel-core-2.23.0.jar:2.23.0] > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) > [camel-core-2.23.0.jar:2.23.0] > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) > [camel-core-2.23.0.jar:2.23.0] > at > org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:454) > [camel-core-2.23.0.jar:2.23.0] > at > org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:223) > [camel-core-2.23.0.jar:2.23.0] > at > org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:187) > [camel-core-2.23.0.jar:2.23.0] > at > org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174) > [camel-core-2.23.0.jar:2.23.0] > at > org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101) > [camel-core-2.23.0.jar:2.23.0] > at > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) > [na:1.8.0_201] > at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) > [na:1.8.0_201] > at > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) > [na:1.8.0_201] > at > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) > [na:1.8.0_201] > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) > [na:1.8.0_201] > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) > [na:1.8.0_201] > at java.lang.Thread.run(Thread.java:748) [na:1.8.0_201] > {code} > Here i provide some basic *working code* for transforming the provided avro > file to json > {code:java} > private static Iterator<?> toJsonIterator(File file) throws IOException { > return new DataFileReader<>(file, new GenericDatumReader<>()); > } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)