X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=netconf%2Fnetconf-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Futil%2Fmessages%2FNetconfMessageUtil.java;h=d61b3c6d274fb625ebdf924b336f37f64ae84c64;hb=14323f32667c16d5206e73bfe34eea48d4e2272f;hp=f4795aea98995d02c0051b5cae024e5c1b8e8a68;hpb=4e99f8da93b99168e8f43f68e238ff4e1fdda8cd;p=netconf.git diff --git a/netconf/netconf-util/src/main/java/org/opendaylight/netconf/util/messages/NetconfMessageUtil.java b/netconf/netconf-util/src/main/java/org/opendaylight/netconf/util/messages/NetconfMessageUtil.java index f4795aea98..d61b3c6d27 100644 --- a/netconf/netconf-util/src/main/java/org/opendaylight/netconf/util/messages/NetconfMessageUtil.java +++ b/netconf/netconf-util/src/main/java/org/opendaylight/netconf/util/messages/NetconfMessageUtil.java @@ -55,7 +55,15 @@ public final class NetconfMessageUtil { } public static boolean isErrorMessage(final XmlElement xmlElement) throws NetconfDocumentedException { + + // In the case of multiple rpc-error messages, size will not be 1 but we still want to report as Error if (xmlElement.getChildElements().size() != 1) { + List allResults = xmlElement.getChildElements(); + for (XmlElement result : allResults) { + if (result.getName().equals(DocumentedException.RPC_ERROR)) { + return true; + } + } return false; } try { @@ -70,7 +78,7 @@ public final class NetconfMessageUtil { // Extract child element from with or without(fallback) the same namespace Optional capabilitiesElement = responseElement .getOnlyChildElementWithSameNamespaceOptionally(XmlNetconfConstants.CAPABILITIES); - if (!capabilitiesElement.isPresent()) { + if (capabilitiesElement.isEmpty()) { capabilitiesElement = responseElement.getOnlyChildElementOptionally(XmlNetconfConstants.CAPABILITIES); }