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 4f8140e..6f32371 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());
 
-        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()),

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.