diff --git a/entity-registry/src/main/java/com/linkedin/metadata/models/registry/ConfigEntityRegistry.java b/entity-registry/src/main/java/com/linkedin/metadata/models/registry/ConfigEntityRegistry.java index 969b6587a2eeb..9aed29ab8595e 100644 --- a/entity-registry/src/main/java/com/linkedin/metadata/models/registry/ConfigEntityRegistry.java +++ b/entity-registry/src/main/java/com/linkedin/metadata/models/registry/ConfigEntityRegistry.java @@ -189,7 +189,7 @@ public String getIdentifier() { private AspectSpec buildAspectSpec(String aspectName, EntitySpecBuilder entitySpecBuilder) { Optional aspectSchema = dataSchemaFactory.getAspectSchema(aspectName); Optional aspectClass = dataSchemaFactory.getAspectClass(aspectName); - if (aspectSchema.isEmpty()) { + if (!aspectSchema.isPresent()) { throw new IllegalArgumentException(String.format("Aspect %s does not exist", aspectName)); } return entitySpecBuilder.buildAspectSpec(aspectSchema.get(), aspectClass.get()); @@ -197,7 +197,7 @@ private AspectSpec buildAspectSpec(String aspectName, EntitySpecBuilder entitySp private EventSpec buildEventSpec(String eventName) { Optional eventSchema = dataSchemaFactory.getEventSchema(eventName); - if (eventSchema.isEmpty()) { + if (!eventSchema.isPresent()) { throw new IllegalArgumentException(String.format("Event %s does not exist", eventName)); } return new EventSpecBuilder().buildEventSpec(eventName, eventSchema.get()); diff --git a/entity-registry/src/main/java/com/linkedin/metadata/models/registry/PatchEntityRegistry.java b/entity-registry/src/main/java/com/linkedin/metadata/models/registry/PatchEntityRegistry.java index 59309e255a906..b4fc4193e7263 100644 --- a/entity-registry/src/main/java/com/linkedin/metadata/models/registry/PatchEntityRegistry.java +++ b/entity-registry/src/main/java/com/linkedin/metadata/models/registry/PatchEntityRegistry.java @@ -282,7 +282,7 @@ public AspectTemplateEngine getAspectTemplateEngine() { private AspectSpec buildAspectSpec(String aspectName, EntitySpecBuilder entitySpecBuilder) { Optional aspectSchema = dataSchemaFactory.getAspectSchema(aspectName); Optional aspectClass = dataSchemaFactory.getAspectClass(aspectName); - if (aspectSchema.isEmpty()) { + if (!aspectSchema.isPresent()) { throw new IllegalArgumentException(String.format("Aspect %s does not exist", aspectName)); } AspectSpec aspectSpec = @@ -294,7 +294,7 @@ private AspectSpec buildAspectSpec(String aspectName, EntitySpecBuilder entitySp private EventSpec buildEventSpec(String eventName) { Optional eventSchema = dataSchemaFactory.getEventSchema(eventName); - if (eventSchema.isEmpty()) { + if (!eventSchema.isPresent()) { throw new IllegalArgumentException(String.format("Event %s does not exist", eventName)); } return new EventSpecBuilder().buildEventSpec(eventName, eventSchema.get());