package org.opendaylight.netconf.mdsal.connector.ops;
import com.google.common.collect.ImmutableMap;
+import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Iterator;
import java.util.Map;
import java.util.Optional;
+import javax.xml.stream.XMLStreamException;
import javax.xml.transform.dom.DOMSource;
import org.opendaylight.netconf.api.DocumentedException;
import org.opendaylight.netconf.api.DocumentedException.ErrorSeverity;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
abstract class AbstractEdit extends AbstractConfigOperation {
private static final Logger LOG = LoggerFactory.getLogger(AbstractEdit.class);
this.schemaContext = schemaContext;
}
- @SuppressWarnings("checkstyle:IllegalCatch")
protected void parseIntoNormalizedNode(final DataSchemaNode schemaNode, final XmlElement element,
final NormalizedNodeStreamWriter writer) throws DocumentedException {
if (!(schemaNode instanceof ContainerSchemaNode) && !(schemaNode instanceof ListSchemaNode)) {
final XmlParserStream xmlParser = XmlParserStream.create(writer, schemaContext.getCurrentContext(), schemaNode);
try {
xmlParser.traverse(new DOMSource(element.getDomElement()));
- } catch (final Exception ex) {
+ } catch (final XMLStreamException | URISyntaxException | IOException | SAXException ex) {
throw new NetconfDocumentedException("Error parsing input: " + ex.getMessage(), ex, ErrorType.PROTOCOL,
ErrorTag.MALFORMED_MESSAGE, ErrorSeverity.ERROR);
}
protected DataSchemaNode getSchemaNodeFromNamespace(final String namespace, final XmlElement element)
throws DocumentedException {
- final Iterator<Module> it;
+ final Iterator<? extends Module> it;
try {
// Returns module with newest revision since findModuleByNamespace returns a set of modules and we only
// need the newest one
final String elementName = element.getName();
final Optional<DataSchemaNode> schemaNode = module.findDataChildByName(QName.create(module.getQNameModule(),
element.getName()));
- if (!schemaNode.isPresent()) {
+ if (schemaNode.isEmpty()) {
throw new DocumentedException(
"Unable to find node " + elementName + " with namespace: " + namespace + "in module: "
+ module.toString(),