Skip to content

Commit fb429bc

Browse files
committed
Fix NullAway suppression in PulsarConfiguration
See gh-46587
1 parent 7766ea5 commit fb429bc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

module/spring-boot-pulsar/src/main/java/org/springframework/boot/pulsar/autoconfigure/PulsarConfiguration.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import org.springframework.pulsar.function.PulsarFunctionAdministration;
5454
import org.springframework.pulsar.function.PulsarSink;
5555
import org.springframework.pulsar.function.PulsarSource;
56+
import org.springframework.util.Assert;
5657

5758
/**
5859
* Common configuration used by both {@link PulsarAutoConfiguration} and
@@ -146,10 +147,11 @@ private void addCustomSchemaMapping(DefaultSchemaResolver schemaResolver, TypeMa
146147
}
147148
}
148149

149-
@SuppressWarnings("NullAway") // Resolved.orElseThrow() doesn't return nullable
150150
private Schema<Object> getSchema(DefaultSchemaResolver schemaResolver, SchemaType schemaType, Class<?> messageType,
151151
@Nullable Class<?> messageKeyType) {
152-
return schemaResolver.resolveSchema(schemaType, messageType, messageKeyType).orElseThrow();
152+
Schema<Object> schema = schemaResolver.resolveSchema(schemaType, messageType, messageKeyType).orElseThrow();
153+
Assert.state(schema != null, "'schema' must not be null");
154+
return schema;
153155
}
154156

155157
@SuppressWarnings("unchecked")

0 commit comments

Comments
 (0)