This closes Missing catch clauses in Confluent Schema Registry client
@@ -151,12 +151,13 @@ public class RestSchemaRegistryClient implements SchemaRegistryClient {
}
} catch (SchemaNotFoundException e) {
- logger.debug("Could not find schema name in registry by id in: " + schemaPath);
+ logger.debug("Could not find schema metadata in registry by id and subjects in: " + schemaPath);
}
// Get all couples (subject name, version) for a given schema ID
// GET /schemas/ids/{int: id}/versions
if(completeSchema == null) {
+ try {
JsonNode subjectsVersions = fetchJsonResponse(schemaPath + "/versions", "schema name");
if(subjectsVersions != null) {
@@ -177,10 +178,14 @@ public class RestSchemaRegistryClient implements SchemaRegistryClient {
return createRecordSchema(subjectName, maxVersion, schemaId, schemaJson.get(SCHEMA_TEXT_FIELD_NAME).asText());
}
}
+ } catch (SchemaNotFoundException e) {
+ logger.debug("Could not find schema metadata in registry by id and versions in: " + schemaPath);
+ }
}
// Last resort option: we get the full list of subjects and check one by one to get the complete schema info
if(completeSchema == null) {
+ try {
final JsonNode subjectsAllJson = fetchJsonResponse("/subjects", "subjects array");
final ArrayNode subjectsAllList = (ArrayNode) subjectsAllJson;
for (JsonNode subject: subjectsAllList) {
@@ -192,6 +197,9 @@ public class RestSchemaRegistryClient implements SchemaRegistryClient {
continue;
}
}
+ } catch (SchemaNotFoundException e) {
+ logger.debug("Could not find schema metadata in registry by iterating through subjects");
+ }
}
// At this point, we could not get a subject/version associated to the schema and its ID
