[
https://issues.apache.org/jira/browse/NIFI-3832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16003209#comment-16003209
]
ASF subversion and git services commented on NIFI-3832:
-------------------------------------------------------
Commit 744ecc3d83a203db67cc8e99aa97bf1985e16470 in nifi's branch
refs/heads/master from [~ijokarumawak]
[ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=744ecc3 ]
NIFI-3832: Fixed AvroRecordSetWriter validation NPE.
This closes #1768.
> 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)