import com.google.common.base.Preconditions;
import io.netty.channel.Channel;
+import org.opendaylight.controller.netconf.api.NetconfSession;
import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
import org.opendaylight.controller.netconf.api.NetconfMessage;
-import org.opendaylight.controller.netconf.api.NetconfSession;
import org.opendaylight.controller.netconf.util.xml.XMLNetconfUtil;
import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;
import org.opendaylight.controller.netconf.util.xml.XmlUtil;
import java.io.InputStream;
import java.util.Map.Entry;
-public class SendErrorExceptionUtil {
+public final class SendErrorExceptionUtil {
private static final Logger logger = LoggerFactory.getLogger(SendErrorExceptionUtil.class);
+ private SendErrorExceptionUtil() {}
+
public static void sendErrorMessage(final NetconfSession session,
final NetconfDocumentedException sendErrorException) {
- logger.info("Sending error {}", sendErrorException.getMessage(), sendErrorException);
+ logger.trace("Sending error {}", sendErrorException.getMessage(), sendErrorException);
final Document errorDocument = createDocument(sendErrorException);
session.sendMessage(new NetconfMessage(errorDocument));
}
public static void sendErrorMessage(Channel channel, NetconfDocumentedException sendErrorException) {
- logger.info("Sending error {}", sendErrorException.getMessage(), sendErrorException);
+ logger.trace("Sending error {}", sendErrorException.getMessage(), sendErrorException);
final Document errorDocument = createDocument(sendErrorException);
channel.writeAndFlush(new NetconfMessage(errorDocument));
}
public static void sendErrorMessage(NetconfSession session, NetconfDocumentedException sendErrorException,
NetconfMessage incommingMessage) {
final Document errorDocument = createDocument(sendErrorException);
- logger.info("Sending error {}", XmlUtil.toString(errorDocument));
+ logger.trace("Sending error {}", XmlUtil.toString(errorDocument));
tryToCopyAttributes(incommingMessage.getDocument(), errorDocument, sendErrorException);
session.sendMessage(new NetconfMessage(errorDocument));
}
for (int i = 0; i < incomingAttributes.getLength(); i++) {
final Attr attr = (Attr) incomingAttributes.item(i);
// skip namespace
- if (attr.getNodeName().equals(XmlUtil.XMLNS_ATTRIBUTE_KEY))
+ if (attr.getNodeName().equals(XmlUtil.XMLNS_ATTRIBUTE_KEY)) {
continue;
+ }
rpcReply.setAttributeNode((Attr) errorDocument.importNode(attr, true));
}
} catch (final Exception e) {