From 98638b5ec9bb8f7ce5f58b75d04e89d7a4a27681 Mon Sep 17 00:00:00 2001 From: Saravanan Raju Date: Wed, 22 Jan 2020 17:29:56 +0530 Subject: [PATCH] HOTFIX-3715 ISSUE-653 : Fix NPE while deleting schema metadata with no schema versions (#654) (cherry picked from commit 7e524f6b4718c97fe7968152f9bdb0db56fb5770) --- .../registries/schemaregistry/DefaultSchemaRegistry.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/schema-registry/core/src/main/java/com/hortonworks/registries/schemaregistry/DefaultSchemaRegistry.java b/schema-registry/core/src/main/java/com/hortonworks/registries/schemaregistry/DefaultSchemaRegistry.java index 578779071..0995a98ea 100644 --- a/schema-registry/core/src/main/java/com/hortonworks/registries/schemaregistry/DefaultSchemaRegistry.java +++ b/schema-registry/core/src/main/java/com/hortonworks/registries/schemaregistry/DefaultSchemaRegistry.java @@ -309,7 +309,8 @@ public void deleteSchema(String schemaName) throws SchemaNotFoundException { } } // Remove all serdes mappings for this schema name - Collection schemaSerDesMappings = getSchemaSerDesMappings(schemaMetadataId); + SchemaMetadataInfo schemaMetadataInfo = getSchemaMetadataInfo(schemaName); + Collection schemaSerDesMappings = getSchemaSerDesMappings(schemaMetadataInfo.getId()); if (schemaSerDesMappings != null) { for (SchemaSerDesMapping schemaSerDesMapping: schemaSerDesMappings) { storageManager.remove(schemaSerDesMapping.getStorableKey());