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%2FNetconfUtil.java;fp=opendaylight%2Fnetconf%2Fnetconf-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Futil%2FNetconfUtil.java;h=b0884ca2fb4bc648183841241967660c3f9fc9f3;hb=749b52034c030428135f49f65a96c4da13f1277c;hp=796ab91a504040e87197f9032d85e4699d4c80b5;hpb=36173c816a96cb06f2493709a3f13b95f9ad9806;p=controller.git diff --git a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/NetconfUtil.java b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/NetconfUtil.java index 796ab91a50..b0884ca2fb 100644 --- a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/NetconfUtil.java +++ b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/NetconfUtil.java @@ -56,13 +56,17 @@ public final class NetconfUtil { return (doc == null) ? null : new NetconfMessage(doc); } - public static void checkIsMessageOk(NetconfMessage responseMessage) throws ConflictingVersionException { - XmlElement element = XmlElement.fromDomDocument(responseMessage.getDocument()); + public static Document checkIsMessageOk(NetconfMessage responseMessage) throws ConflictingVersionException { + return checkIsMessageOk(responseMessage.getDocument()); + } + + public static Document checkIsMessageOk(Document response) throws ConflictingVersionException { + XmlElement element = XmlElement.fromDomDocument(response); Preconditions.checkState(element.getName().equals(XmlNetconfConstants.RPC_REPLY_KEY)); element = element.getOnlyChildElement(); if (element.getName().equals(XmlNetconfConstants.OK)) { - return; + return response; } if (element.getName().equals(XmlNetconfConstants.RPC_ERROR)) { @@ -74,11 +78,11 @@ public final class NetconfUtil { throw new ConflictingVersionException(error); } throw new IllegalStateException("Can not load last configuration, operation failed: " - + XmlUtil.toString(responseMessage.getDocument())); + + XmlUtil.toString(response)); } logger.warn("Can not load last configuration. Operation failed."); throw new IllegalStateException("Can not load last configuration. Operation failed: " - + XmlUtil.toString(responseMessage.getDocument())); + + XmlUtil.toString(response)); } }