Feroze Daud created AVRO-3976: --------------------------------- Summary: frag2json throws Exception after reading file Key: AVRO-3976 URL: https://issues.apache.org/jira/browse/AVRO-3976 Project: Apache Avro Issue Type: Bug Components: tools Affects Versions: 1.11.1 Reporter: Feroze Daud
I downloaded a message from a kafka topic, that had been serialized with Confluents `KafkaAvroSerializer` class. {noformat} ./kafka-console-consumer.sh --topic abtrial-prod-topic --partition 0 --offset latest --max-messages 1 > ab_message.bin{noformat} Then I stripped the first 4 bytes from the message {noformat} dd if=ab_message.bin of=ab_message_data.bin skip=5 bs=1{noformat} Finally, I am using avro-tools with the schema file to read this message: {noformat} $ java -jar /tmp/avro-tools-1.11.1.jar fragtojson --schema-file abtrial.avsc ab_message_data.bin { "schema_version" : "1.0", "trial_id" : 1710319307, "trial_name" : "e7176766-78c0-4896-9b7b-698615c08bf7", "status" : "pending", "tracking_slot" : null, "created" : { "principal" : "canary-c437e764-48ba-4dcc-9640-52638f737971", "date" : "2024/04/15 20:39:50" }, "updated" : { "principal" : null, "date" : null } }Exception in thread "main" java.io.EOFException at org.apache.avro.io.BinaryDecoder$InputStreamByteSource.readRaw(BinaryDecoder.java:883) at org.apache.avro.io.BinaryDecoder.doReadBytes(BinaryDecoder.java:405) at org.apache.avro.io.BinaryDecoder.readString(BinaryDecoder.java:313) at org.apache.avro.io.ResolvingDecoder.readString(ResolvingDecoder.java:208) at org.apache.avro.generic.GenericDatumReader.readString(GenericDatumReader.java:470) at org.apache.avro.generic.GenericDatumReader.readString(GenericDatumReader.java:460) at org.apache.avro.generic.GenericDatumReader.readWithoutConversion(GenericDatumReader.java:192) at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:161) at org.apache.avro.generic.GenericDatumReader.readField(GenericDatumReader.java:260) at org.apache.avro.generic.GenericDatumReader.readRecord(GenericDatumReader.java:248) at org.apache.avro.generic.GenericDatumReader.readWithoutConversion(GenericDatumReader.java:180) at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:161) at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:154) at org.apache.avro.tool.BinaryFragmentToJsonTool.run(BinaryFragmentToJsonTool.java:78) at org.apache.avro.tool.Main.run(Main.java:67) at org.apache.avro.tool.Main.main(Main.java:56){noformat} Why is it printing the exception at the end? -- This message was sent by Atlassian Jira (v8.20.10#820010)