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

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

Github user markap14 commented on the issue:

    https://github.com/apache/nifi/pull/1768
  
    @ijokarumawak thanks for the PR, and for catching the bug. Verified that 
NiFi was exhibiting the behavior that you described before and that after the 
PR the behavior was as-expected. +1 merged to master!


> AvroRecordSetWriter initial validation fails with NullPointerException
> ----------------------------------------------------------------------
>
>                 Key: NIFI-3832
>                 URL: https://issues.apache.org/jira/browse/NIFI-3832
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: 1.2.0
>            Reporter: Koji Kawamura
>            Assignee: Koji Kawamura
>            Priority: Minor
>
> AvroRecordSetWriter overrides default value for SCHEMA_WRITE_STRATEGY to 
> AVRO_EMBEDDED. However getRequiredSchemaFields uses SCHEMA_WRITE_STRATEGY 
> constant defined in its super class to get value, which has 
> SCHAMA_NAME_ATTRIBUTE as its default value.
> So, at the initial validation (before user hit apply button), following code 
> go through the if statement and results in NPE:
> {code}
>     @Override
>     protected Set<SchemaField> getRequiredSchemaFields(final 
> ValidationContext validationContext) {
>         final String writeStrategyValue = 
> validationContext.getProperty(SCHEMA_WRITE_STRATEGY).getValue();
>         if (writeStrategyValue.equalsIgnoreCase(AVRO_EMBEDDED.getValue())) {
>             return requiredSchemaFields;
>         }
>         return super.getRequiredSchemaFields(validationContext);
>     }
> {code}
> Here is the stacktrace:
> {code}
> 2017-05-08 19:19:22,749 ERROR [NiFi Web Server-158] 
> o.a.n.c.AbstractConfiguredComponent Failed to perform validation of 
> AvroRecordSetWriter[id=e78aac25-015b-1000-f931-33bf517d5e42]
> java.lang.NullPointerException: null
>         at 
> org.apache.nifi.serialization.SchemaRegistryRecordSetWriter.getRequiredSchemaFields(SchemaRegistryRecordSetWriter.java:138)
>         at 
> org.apache.nifi.avro.AvroRecordSetWriter.getRequiredSchemaFields(AvroRecordSetWriter.java:138)
>         at 
> org.apache.nifi.serialization.SchemaRegistryRecordSetWriter.customValidate(SchemaRegistryRecordSetWriter.java:147)
>         at 
> org.apache.nifi.components.AbstractConfigurableComponent.validate(AbstractConfigurableComponent.java:126)
>         at 
> org.apache.nifi.controller.AbstractConfiguredComponent.getValidationErrors(AbstractConfiguredComponent.java:460)
>         at 
> org.apache.nifi.controller.service.StandardControllerServiceNode.getValidationErrors(StandardControllerServiceNode.java:506)
>         at 
> org.apache.nifi.controller.AbstractConfiguredComponent.getValidationErrors(AbstractConfiguredComponent.java:448)
>         at 
> org.apache.nifi.web.api.dto.DtoFactory.createControllerServiceDto(DtoFactory.java:1381)
>         at 
> org.apache.nifi.web.StandardNiFiServiceFacade.createControllerServiceEntity(StandardNiFiServiceFacade.java:30
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to