X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fconfig-persister-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fpersist%2Fimpl%2FUtil.java;h=322a9b753b123c006a4298b3209163b9ea82e9ed;hb=31ea7166f7cf572b3d2c51e2749bb94e8f8af821;hp=811ba38c10068d470492a93073a656f6b0c42f79;hpb=de12565a7795af98788f8150eb0072f9c985f4a1;p=controller.git diff --git a/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/Util.java b/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/Util.java index 811ba38c10..322a9b753b 100644 --- a/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/Util.java +++ b/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/Util.java @@ -8,19 +8,11 @@ package org.opendaylight.controller.netconf.persist.impl; -import org.opendaylight.controller.config.api.ConflictingVersionException; -import org.opendaylight.controller.netconf.api.NetconfMessage; import org.opendaylight.controller.netconf.client.NetconfClient; import org.opendaylight.controller.netconf.client.NetconfClientDispatcher; -import org.opendaylight.controller.netconf.util.xml.XMLNetconfUtil; -import org.opendaylight.controller.netconf.util.xml.XmlElement; -import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants; -import org.opendaylight.controller.netconf.util.xml.XmlUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpression; import java.util.Set; public final class Util { @@ -40,8 +32,6 @@ public final class Util { return true; } - - // TODO: check if closing in correct order public static void closeClientAndDispatcher(NetconfClient client) { NetconfClientDispatcher dispatcher = client.getNetconfClientDispatcher(); Exception fromClient = null; @@ -60,27 +50,4 @@ public final class Util { } } } - - - public static void checkIsOk(XmlElement element, NetconfMessage responseMessage) throws ConflictingVersionException { - if (element.getName().equals(XmlNetconfConstants.OK)) { - return; - } - - if (element.getName().equals(XmlNetconfConstants.RPC_ERROR)) { - logger.warn("Can not load last configuration, operation failed"); - // is it ConflictingVersionException ? - XPathExpression xPathExpression = XMLNetconfUtil.compileXPath("/netconf:rpc-reply/netconf:rpc-error/netconf:error-info/netconf:error"); - String error = (String) XmlUtil.evaluateXPath(xPathExpression, element.getDomElement(), XPathConstants.STRING); - if (error!=null && error.contains(ConflictingVersionException.class.getCanonicalName())) { - throw new ConflictingVersionException(error); - } - throw new IllegalStateException("Can not load last configuration, operation failed: " - + XmlUtil.toString(responseMessage.getDocument())); - } - - logger.warn("Can not load last configuration. Operation failed."); - throw new IllegalStateException("Can not load last configuration. Operation failed: " - + XmlUtil.toString(responseMessage.getDocument())); - } }