diff --git a/nifi-extension-bundles/nifi-registry-bundle/nifi-registry-service/src/main/java/org/apache/nifi/schemaregistry/services/AvroSchemaRegistry.java b/nifi-extension-bundles/nifi-registry-bundle/nifi-registry-service/src/main/java/org/apache/nifi/schemaregistry/services/AvroSchemaRegistry.java index f2ad959895647..c8bec9e2c3adb 100644 --- a/nifi-extension-bundles/nifi-registry-bundle/nifi-registry-service/src/main/java/org/apache/nifi/schemaregistry/services/AvroSchemaRegistry.java +++ b/nifi-extension-bundles/nifi-registry-bundle/nifi-registry-service/src/main/java/org/apache/nifi/schemaregistry/services/AvroSchemaRegistry.java @@ -16,6 +16,7 @@ */ package org.apache.nifi.schemaregistry.services; +import org.apache.avro.NameValidator; import org.apache.avro.Schema; import org.apache.nifi.annotation.behavior.DynamicProperty; import org.apache.nifi.annotation.documentation.CapabilityDescription; @@ -87,7 +88,7 @@ public void onPropertyModified(final PropertyDescriptor descriptor, final String } else { try { // Use a non-strict parser here, a strict parse can be done (if specified) in customValidate(). - final Schema avroSchema = new Schema.Parser().setValidate(false).parse(newValue); + final Schema avroSchema = new Schema.Parser(NameValidator.NO_VALIDATION).parse(newValue); final SchemaIdentifier schemaId = SchemaIdentifier.builder().name(descriptor.getName()).build(); final RecordSchema recordSchema = AvroTypeUtil.createSchema(avroSchema, newValue, schemaId); recordSchemas.put(descriptor.getName(), recordSchema); @@ -109,7 +110,7 @@ protected Collection customValidate(ValidationContext validati String input = entry.getValue(); try { - final Schema avroSchema = new Schema.Parser().setValidate(strict).parse(input); + final Schema avroSchema = new Schema.Parser(strict ? NameValidator.STRICT_VALIDATOR : NameValidator.UTF_VALIDATOR).parse(input); AvroTypeUtil.createSchema(avroSchema, input, SchemaIdentifier.EMPTY); } catch (final Exception e) { results.add(new ValidationResult.Builder()