From 5a6f5334c7296afee857342643fe9fb386322d36 Mon Sep 17 00:00:00 2001 From: Bill Smith Date: Mon, 12 Nov 2018 09:22:54 -0700 Subject: [PATCH] [SHIBUI-701] Clarified a couple error states. --- .../admin/ui/jsonschema/JsonSchemaResourceLocation.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/jsonschema/JsonSchemaResourceLocation.java b/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/jsonschema/JsonSchemaResourceLocation.java index 69c8e4d9a..05280d45e 100644 --- a/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/jsonschema/JsonSchemaResourceLocation.java +++ b/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/jsonschema/JsonSchemaResourceLocation.java @@ -122,8 +122,10 @@ public static List getResolverTypes() { public static SchemaType getSchemaType(String jsonType) { List schemaTypes = Stream.of(SchemaType.values()).filter(it -> it.getJsonType().equals(jsonType)).collect(Collectors.toList()); - if (schemaTypes.size() != 1) { - throw new RuntimeException("Found two schema types for jsonType (" + jsonType + ")! How did this even happen?"); + if (schemaTypes.size() > 1) { + throw new RuntimeException("Found multiple schema types for jsonType (" + jsonType + ")!"); + } else if (schemaTypes.size() == 0) { + throw new RuntimeException("Found no schema types for jsonType (" + jsonType + ")! Verify that the code supports all schema types."); } else { return schemaTypes.get(0); }