Open birTiwana opened 1 year ago
One thing to check, I think, is to ensure that this:
sampleRecordDto.toByteBuffer().array()
returns valid encoded document where content is at 0-offset. ByteBuffer
could return backing array that has different offset; so checking what ByteBuffer.arrayOffset()
returns would be good -- if it's not 0
there'd be a problem.
In general there is some discrepancy between data being decoded and schema; Avro as a format is very fragile unfortunately (as it thrives to be as compact as possible, little redundancy) and it is very easy to get corrupt data.
Also make sure to use a recent Jackson version; I don't think that is necessarily the problem here but sometimes bugs are reported against very old version and fix exists in newer versions.
I checked and the value ByteBuffer.arrayOffset()
is actually 0.
I have created a very simple avro schema file:
Then generating a SampleRecordDto file from this using the following avro-maven-plugin.
After then using jackson-dataformat-avro to convert an object of class SampleRecodDto to JSONNode using the following code:
But I am running into the following exception:
Can I please get some help on this?