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;
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 {
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<String> extractCapabilitiesFromHello(Document doc) throws NetconfDocumentedException {
// 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;
}