[
https://issues.apache.org/jira/browse/NIFI-4215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16113129#comment-16113129
]
Mark Payne commented on NIFI-4215:
----------------------------------
[~WesleyLawrence] [~jameswing] - hey guys sorry, just finished reviewing a bit
deeper so that i understand exactly how this is working. I think when I read
through it the first time, I didn't fully appreciate the approach that was
being taken. In terms of the concern about making it mutable, I am just a fan
of making objects immutable when we can because it simplifies things down the
line and guarantees thread safety. That said, sometimes we can't have
immutability. I think immutability is a great thing to strive for, but it's not
always required. In this case, I agree that it's probably okay to make it
mutable. Specifically, the fact that it is the SimpleRecordReader that
introduces this method, not the interface, makes me feel better. Also, as it is
being used currently, the fields are always being set before the object is ever
provided to another thread, and I believe this means that we are okay in terms
of thread safety (other threads won't get a stale value because the correct
value will always be set before being handed over to another thread). So yes,
I'm okay with this change to make the object mutable, as long as we fix the bug
with the Schema Identifier. Sorry for the alarm there :)
> Avro schemas with records that have a field of themselves fail to parse,
> causing stackoverflow exception
> --------------------------------------------------------------------------------------------------------
>
> Key: NIFI-4215
> URL: https://issues.apache.org/jira/browse/NIFI-4215
> Project: Apache NiFi
> Issue Type: Bug
> Affects Versions: 1.4.0
> Reporter: Wesley L Lawrence
> Priority: Minor
> Attachments: nifi-4215.patch
>
>
> Noticed this while attempting to use the AvroSchemaRegsitry with some complex
> schema. Boiled down, Avro lets you define a schema such as;
> {code}
> {
> "namespace": "org.apache.nifi.testing",
> "name": "CompositRecord",
> "type": "record",
> "fields": [
> {
> "name": "id",
> "type": "int"
> },
> {
> "name": "value",
> "type": "string"
> },
> {
> "name": "parent",
> "type": [
> "null",
> "CompositRecord"
> ]
> }
> ]
> }
> {code}
> The AvroSchemaRegistry (AvroTypeUtil specifically) will fail to parse, and
> generate a stackoverflow exception.
> I've whipped up a fix, tested it out in 1.4.0, and am just running through
> the contrib build before I submit a patch.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)