Skip to content

Commit

Permalink
Fix incorrect orElse usage (#5638)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlesarnal authored Dec 2, 2024
1 parent f977624 commit f82cf04
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,17 @@ public SchemaLookupResult<S> resolveSchema(Record<T> data) {
Objects.requireNonNull(data.payload());


ParsedSchema<S> parsedSchema = null;
ParsedSchema<S> parsedSchema;
if (artifactResolverStrategy.loadSchema() && schemaParser.supportsExtractSchemaFromData()) {
parsedSchema = schemaParser.getSchemaFromData(data, registerDereferenced);
} else {
parsedSchema = null;
}

final ArtifactReference artifactReference = resolveArtifactReference(data, parsedSchema, false, null);

return getSchemaFromCache(artifactReference)
.orElse(getSchemaFromRegistry(parsedSchema, data, artifactReference));
.orElseGet(() -> getSchemaFromRegistry(parsedSchema, data, artifactReference));
}

private Optional<SchemaLookupResult<S>> getSchemaFromCache(ArtifactReference artifactReference) {
Expand Down

0 comments on commit f82cf04

Please sign in to comment.