Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
1.2.0
-
None
Description
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:
@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); }
Here is the stacktrace:
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
Attachments
Issue Links
- links to