Change BindingRuntimeTypes.findIdentity()
[mdsal.git] / binding / mdsal-binding-runtime-api / src / main / java / org / opendaylight / mdsal / binding / runtime / api / AbstractBindingRuntimeContext.java
index bf0dc18a1de77c4392c859b2b8e247dbd45fdf64..e5006154df301f878f0fb9a3c2e5609288f9dee1 100644 (file)
@@ -40,8 +40,10 @@ public abstract class AbstractBindingRuntimeContext implements BindingRuntimeCon
         CacheBuilder.newBuilder().weakValues().build(new CacheLoader<>() {
             @Override
             public Class<? extends BaseIdentity> load(final QName key) {
-                final var type = getTypes().findIdentity(key).orElseThrow(
-                    () -> new IllegalArgumentException("Supplied QName " + key + " is not a valid identity"));
+                final var type = getTypes().identityChild(key);
+                if (type == null) {
+                    throw new IllegalArgumentException("Supplied QName " + key + " is not a valid identity");
+                }
                 try {
                     return loadClass(type.getIdentifier()).asSubclass(BaseIdentity.class);
                 } catch (ClassNotFoundException e) {