X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Futil%2Fmessages%2FNetconfMessageUtil.java;h=3c6b6ccab9efa0a0a28b5630da5d5c9f30157610;hb=95115ca49f3b16b936e0f6c88aedfc17cd0ee92c;hp=61b23202c3a134c27d975279e2f29f7d7eefefa0;hpb=3a71a222b896b9d07e638af62300180799bdac67;p=controller.git diff --git a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/messages/NetconfMessageUtil.java b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/messages/NetconfMessageUtil.java index 61b23202c3..3c6b6ccab9 100644 --- a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/messages/NetconfMessageUtil.java +++ b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/messages/NetconfMessageUtil.java @@ -9,6 +9,7 @@ package org.opendaylight.controller.netconf.util.messages; import com.google.common.base.Function; +import com.google.common.base.Optional; import com.google.common.collect.Collections2; import java.util.Collection; import java.util.List; @@ -59,9 +60,13 @@ public final class NetconfMessageUtil { public static Collection extractCapabilitiesFromHello(Document doc) throws NetconfDocumentedException { XmlElement responseElement = XmlElement.fromDomDocument(doc); - XmlElement capabilitiesElement = responseElement - .getOnlyChildElementWithSameNamespace(XmlNetconfConstants.CAPABILITIES); - List caps = capabilitiesElement.getChildElements(XmlNetconfConstants.CAPABILITY); + // Extract child element from with or without(fallback) the same namespace + Optional capabilitiesElement = responseElement + .getOnlyChildElementWithSameNamespaceOptionally(XmlNetconfConstants.CAPABILITIES) + .or(responseElement + .getOnlyChildElementOptionally(XmlNetconfConstants.CAPABILITIES)); + + List caps = capabilitiesElement.get().getChildElements(XmlNetconfConstants.CAPABILITY); return Collections2.transform(caps, new Function() { @Override