X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-monitoring%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fmonitoring%2FGet.java;h=fa78fa4bd3983c7eee4cb166e54bc5692f0bad54;hp=1b32b52e53476917e4ca57b6f25905fcc5bbd537;hb=ebd9aba9e844229de613a2b60b5d21119fcee968;hpb=d651368d83292f7226a4e91adb55de98036c228f diff --git a/opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/Get.java b/opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/Get.java index 1b32b52e53..fa78fa4bd3 100644 --- a/opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/Get.java +++ b/opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/Get.java @@ -7,25 +7,24 @@ */ package org.opendaylight.controller.netconf.monitoring; -import java.util.Map; +import com.google.common.collect.Maps; import org.opendaylight.controller.netconf.api.NetconfDocumentedException; import org.opendaylight.controller.netconf.api.monitoring.NetconfMonitoringService; +import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants; import org.opendaylight.controller.netconf.mapping.api.HandlingPriority; import org.opendaylight.controller.netconf.mapping.api.NetconfOperationChainedExecution; import org.opendaylight.controller.netconf.monitoring.xml.JaxBSerializer; import org.opendaylight.controller.netconf.monitoring.xml.model.NetconfState; import org.opendaylight.controller.netconf.util.mapping.AbstractNetconfOperation; 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.Preconditions; -import com.google.common.collect.Maps; +import java.util.Map; public class Get extends AbstractNetconfOperation { @@ -37,9 +36,10 @@ public class Get extends AbstractNetconfOperation { this.netconfMonitor = netconfMonitor; } - private Element getPlaceholder(Document innerResult) { + private Element getPlaceholder(Document innerResult) throws NetconfDocumentedException { try { - XmlElement rootElement = XmlElement.fromDomElementWithExpected(innerResult.getDocumentElement(), + XmlElement rootElement = null; + rootElement = XmlElement.fromDomElementWithExpected(innerResult.getDocumentElement(), XmlNetconfConstants.RPC_REPLY_KEY, XmlNetconfConstants.RFC4741_TARGET_NAMESPACE); return rootElement.getOnlyChildElement(XmlNetconfConstants.DATA_KEY).getDomElement(); } catch (RuntimeException e) { @@ -63,8 +63,12 @@ public class Get extends AbstractNetconfOperation { @Override public Document handle(Document requestMessage, NetconfOperationChainedExecution subsequentOperation) throws NetconfDocumentedException { - Preconditions.checkArgument(subsequentOperation.isExecutionTermination() == false, - "Subsequent netconf operation expected by %s", this); + if (subsequentOperation.isExecutionTermination()){ + throw new NetconfDocumentedException(String.format("Subsequent netconf operation expected by %s", this), + NetconfDocumentedException.ErrorType.application, + NetconfDocumentedException.ErrorTag.operation_failed, + NetconfDocumentedException.ErrorSeverity.error); + } try { Document innerResult = subsequentOperation.execute(requestMessage);