Return 404 if no schema found
@@ -84,6 +84,9 @@ public class SchemasResource extends AdminResource {
pulsar().getSchemaRegistryService().getSchema(schemaId)
.handle((schema, error) -> {
if (isNull(error)) {
+ if (isNull(schema)) {
+ response.resume(Response.status(Response.Status.NOT_FOUND).build());
+ } else {
response.resume(
Response.ok()
.encoding(MediaType.APPLICATION_JSON)
@@ -97,6 +100,7 @@ public class SchemasResource extends AdminResource {
)
.build()
);
+ }
} else {
response.resume(error);
}
@@ -122,7 +126,9 @@ public class SchemasResource extends AdminResource {
pulsar().getSchemaRegistryService().getSchema(schemaId, v)
.handle((schema, error) -> {
if (isNull(error)) {
- if (schema.schema.isDeleted()) {
+ if (isNull(schema)) {
+ response.resume(Response.status(Response.Status.NOT_FOUND).build());
+ } else if (schema.schema.isDeleted()) {
response.resume(Response.noContent());
} else {
response.resume(
