diff --git a/nifi-nar-bundles/nifi-confluent-platform-bundle/nifi-confluent-schema-registry-service/src/main/java/org/apache/nifi/confluent/schemaregistry/client/RestSchemaRegistryClient.java b/nifi-nar-bundles/nifi-confluent-platform-bundle/nifi-confluent-schema-registry-service/src/main/java/org/apache/nifi/confluent/schemaregistry/client/RestSchemaRegistryClient.java index 33e74bc186..3bc663c54c 100644 --- a/nifi-nar-bundles/nifi-confluent-platform-bundle/nifi-confluent-schema-registry-service/src/main/java/org/apache/nifi/confluent/schemaregistry/client/RestSchemaRegistryClient.java +++ b/nifi-nar-bundles/nifi-confluent-platform-bundle/nifi-confluent-schema-registry-service/src/main/java/org/apache/nifi/confluent/schemaregistry/client/RestSchemaRegistryClient.java @@ -194,14 +194,16 @@ public class RestSchemaRegistryClient implements SchemaRegistryClient { } } + // At this point, we could not get a subject/version associated to the schema and its ID + // we add the schema and its ID in the cache without a subject/version if(completeSchema == null) { - throw new SchemaNotFoundException("Could not get schema with id: " + schemaId); + return createRecordSchema(null, null, schemaId, schemaJson.get(SCHEMA_TEXT_FIELD_NAME).asText()); } return createRecordSchema(completeSchema); } - private RecordSchema createRecordSchema(final String name, final int version, final int id, final String schema) throws SchemaNotFoundException { + private RecordSchema createRecordSchema(final String name, final Integer version, final int id, final String schema) throws SchemaNotFoundException { try { final Schema avroSchema = new Schema.Parser().parse(schema); final SchemaIdentifier schemaId = SchemaIdentifier.builder().name(name).id((long) id).version(version).build();