Raman Gupta created AVRO-2383:
---------------------------------

             Summary: Avro 1.9 applyAliases broken with self-referential records
                 Key: AVRO-2383
                 URL: https://issues.apache.org/jira/browse/AVRO-2383
             Project: Apache Avro
          Issue Type: Bug
          Components: java
    Affects Versions: 1.9.0
            Reporter: Raman Gupta


If a schema has a field with a self-referential record, the applyAliases 
function produces a NullPointerException.

The problem appears to be that the value for the record put into "seen" has no 
fields, and then when the equality check is done, the `Schema.equals` method 
assumes that fields is not null. Making the `equals` method more defensive with 
null-checking "fields" solves the problem, as the `putAll` method adds the 
fields back in, but I'm not sure if that is actually the best fix.

I will attach a patch with this fix.

I'm marking this as a blocker for 1.9, as this behavior will cause a 
NullPointerException in this situation any time data is decoded where the 
writer and reader schema are different, and there are any aliases defined in 
the reader (even if these aliases are unrelated to the self-referential record).




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to