[ 
https://issues.apache.org/jira/browse/NIFI-4215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16106206#comment-16106206
 ] 

ASF GitHub Bot commented on NIFI-4215:
--------------------------------------

Github user jvwing commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2034#discussion_r130225722
  
    --- Diff: 
nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/avro/AvroTypeUtil.java
 ---
    @@ -218,6 +218,15 @@ private static Schema nullable(final Schema schema) {
          * @return a Data Type that corresponds to the given Avro Schema
          */
         public static DataType determineDataType(final Schema avroSchema) {
    +        return determineDataType(avroSchema, new HashMap<>());
    +    }
    +
    +    public static DataType determineDataType(final Schema avroSchema, 
Map<String, DataType> knownRecordTypes) {
    +
    +        if (knownRecordTypes == null) {
    +            throw new IllegalArgumentException("'foundSchemas' cannot be 
null.");
    --- End diff --
    
    Did you mean this to say "knownRecordTypes" rather than "foundSchemas"?


> 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
>             Fix For: 1.4.0
>
>         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)

Reply via email to