X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fconfig-netconf-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fconfignetconfconnector%2Foperations%2FDiscardChanges.java;h=639d4dac726d4d156659739bb5addaf54578d0ce;hb=3ab0ebe1df3e7606cce0a61572f79bf12deb17c0;hp=b8fa5dd86ee14cf97970f61a2aa988aa8dc5c1d1;hpb=a92d9d6a21a0f6ca8d2153795721f500eaf29ee9;p=controller.git diff --git a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/DiscardChanges.java b/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/DiscardChanges.java index b8fa5dd86e..639d4dac72 100644 --- a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/DiscardChanges.java +++ b/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/DiscardChanges.java @@ -19,11 +19,14 @@ import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorT import org.opendaylight.controller.netconf.confignetconfconnector.transactions.TransactionProvider; 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 org.w3c.dom.Document; import org.w3c.dom.Element; +import com.google.common.base.Optional; + public class DiscardChanges extends AbstractConfigNetconfOperation { public static final String DISCARD = "discard-changes"; @@ -49,10 +52,11 @@ public class DiscardChanges extends AbstractConfigNetconfOperation { } @Override - protected Element handle(Document document, XmlElement xml) throws NetconfDocumentedException { + protected Element handleWithNoSubsequentOperations(Document document, XmlElement xml) throws NetconfDocumentedException { try { fromXml(xml); } catch (final IllegalArgumentException e) { + //FIXME where can IllegalStateException be thrown? logger.warn("Rpc error: {}", ErrorTag.bad_attribute, e); final Map errorInfo = new HashMap<>(); errorInfo.put(ErrorTag.bad_attribute.name(), e.getMessage()); @@ -63,6 +67,7 @@ public class DiscardChanges extends AbstractConfigNetconfOperation { try { this.transactionProvider.abortTransaction(); } catch (final IllegalStateException e) { + //FIXME where can IllegalStateException be thrown? logger.warn("Abort failed: ", e); final Map errorInfo = new HashMap<>(); errorInfo @@ -71,8 +76,8 @@ public class DiscardChanges extends AbstractConfigNetconfOperation { throw new NetconfDocumentedException(e.getMessage(), e, ErrorType.application, ErrorTag.operation_failed, ErrorSeverity.error, errorInfo); } - logger.info("Changes discarded successfully from datastore {}", Datastore.candidate); + logger.trace("Changes discarded successfully from datastore {}", Datastore.candidate); - return document.createElement(XmlNetconfConstants.OK); + return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent()); } }