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=354d74016d48f170321bfca9e9d5886a5a03b851;hb=23fe9ca678ada6263fec5dd996f4025e4a32fcf5;hp=3c6b6ccab9efa0a0a28b5630da5d5c9f30157610;hpb=412db94945c5db5d2da918f5e23bd3abcecc4d10;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 3c6b6ccab9..354d74016d 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 @@ -14,10 +14,11 @@ import com.google.common.collect.Collections2; import java.util.Collection; import java.util.List; import javax.annotation.Nonnull; +import org.opendaylight.controller.config.util.xml.DocumentedException; +import org.opendaylight.controller.config.util.xml.XmlElement; import org.opendaylight.controller.netconf.api.NetconfDocumentedException; import org.opendaylight.controller.netconf.api.NetconfMessage; import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants; -import org.opendaylight.controller.netconf.util.xml.XmlElement; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; @@ -40,7 +41,11 @@ public final class NetconfMessageUtil { if(xmlElement.getChildElements().size() != 1) { return false; } - return xmlElement.getOnlyChildElement().getName().equals(XmlNetconfConstants.OK); + try { + return xmlElement.getOnlyChildElement().getName().equals(XmlNetconfConstants.OK); + } catch (DocumentedException e) { + throw new NetconfDocumentedException(e); + } } public static boolean isErrorMessage(NetconfMessage message) throws NetconfDocumentedException { @@ -55,7 +60,11 @@ public final class NetconfMessageUtil { if(xmlElement.getChildElements().size() != 1) { return false; } - return xmlElement.getOnlyChildElement().getName().equals(XmlNetconfConstants.RPC_ERROR); + try { + return xmlElement.getOnlyChildElement().getName().equals(DocumentedException.RPC_ERROR); + } catch (DocumentedException e) { + throw new NetconfDocumentedException(e); + } } public static Collection extractCapabilitiesFromHello(Document doc) throws NetconfDocumentedException { @@ -74,7 +83,7 @@ public final class NetconfMessageUtil { // Trim possible leading/tailing whitespace try { return input.getTextContent().trim(); - } catch (NetconfDocumentedException e) { + } catch (DocumentedException e) { LOG.trace("Error fetching input text content",e); return null; }