Remove use of getDataChildByName() 21/90021/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 28 May 2020 05:52:46 +0000 (07:52 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 28 May 2020 06:03:08 +0000 (08:03 +0200)
findDataChildByName() provides a proper Optional-based interface,
use that instead of the deprecated method.

Change-Id: I7813e308f1fac5a07cfa9eba2f96e5df981378cf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/ext/DataStoreAppConfigDefaultXMLReader.java

index 4f8140eaa657b5a2ae64926ca25fc355b2e2ed65..6f323716ee481a2bb5e015b9b57e985fdfaf8d3b 100644 (file)
@@ -117,7 +117,10 @@ public class DataStoreAppConfigDefaultXMLReader<T extends DataObject> {
         checkNotNull(module, "%s: Could not obtain the module schema for namespace %s, revision %s",
                 logName, bindingContext.bindingQName.getNamespace(), bindingContext.bindingQName.getRevision());
 
         checkNotNull(module, "%s: Could not obtain the module schema for namespace %s, revision %s",
                 logName, bindingContext.bindingQName.getNamespace(), bindingContext.bindingQName.getRevision());
 
-        DataSchemaNode dataSchema = module.getDataChildByName(bindingContext.bindingQName);
+        QName qname = bindingContext.bindingQName;
+        DataSchemaNode dataSchema = module.findDataChildByName(qname).orElseThrow(
+            () -> new ConfigXMLReaderException(logName + ": Could not obtain the schema for " + qname));
+
         checkNotNull(dataSchema, "%s: Could not obtain the schema for %s", logName, bindingContext.bindingQName);
 
         checkCondition(bindingContext.schemaType.isAssignableFrom(dataSchema.getClass()),
         checkNotNull(dataSchema, "%s: Could not obtain the schema for %s", logName, bindingContext.bindingQName);
 
         checkCondition(bindingContext.schemaType.isAssignableFrom(dataSchema.getClass()),