Remove NetconfDocumentedException throws 56/105656/3
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 25 Apr 2023 13:43:29 +0000 (15:43 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 25 Apr 2023 13:54:55 +0000 (15:54 +0200)
NetconfMessageUtil methods do not throw this exception, remove the
declaration.

Change-Id: Ib0ab7993cbe66c62508e3b95f7dff040a1ca8e8b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
protocol/netconf-client/src/main/java/org/opendaylight/netconf/client/NetconfClientSessionNegotiator.java
protocol/netconf-util/src/main/java/org/opendaylight/netconf/util/messages/NetconfMessageUtil.java

index 0c98fa3f42edf08fbc86c90e7b515c514fe9ce6e..0c1b943ba203c20faa475b9181344bb64c0d16a2 100644 (file)
@@ -173,7 +173,7 @@ class NetconfClientSessionNegotiator
 
         @SuppressWarnings("checkstyle:IllegalCatch")
         @Override
-        public void channelRead(final ChannelHandlerContext ctx, final Object msg) throws Exception {
+        public void channelRead(final ChannelHandlerContext ctx, final Object msg) {
             ctx.pipeline().remove(ExiConfirmationInboundHandler.EXI_CONFIRMED_HANDLER);
 
             NetconfMessage netconfMessage = (NetconfMessage) msg;
@@ -185,8 +185,8 @@ class NetconfClientSessionNegotiator
                     session.startExiCommunication(startExiMessage);
                 } catch (RuntimeException e) {
                     // Unable to add exi, continue without exi
-                    LOG.warn("Unable to start exi communication, Communication will continue without exi on session "
-                            + "{}", session, e);
+                    LOG.warn("Unable to start exi communication, Communication will continue without exi on session {}",
+                        session, e);
                 }
 
                 // Error response
index 59806627e6d23b0cecb60bd62889dad1558c507e..84a6ba0ed6cc484c869441f6fe0c164d6f0a6a47 100644 (file)
@@ -12,7 +12,6 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Optional;
 import org.opendaylight.netconf.api.DocumentedException;
-import org.opendaylight.netconf.api.NetconfDocumentedException;
 import org.opendaylight.netconf.api.NetconfMessage;
 import org.opendaylight.netconf.api.xml.XmlElement;
 import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
@@ -27,28 +26,28 @@ public final class NetconfMessageUtil {
         // Hidden on purpose
     }
 
-    public static boolean isOKMessage(final NetconfMessage message) throws NetconfDocumentedException {
+    public static boolean isOKMessage(final NetconfMessage message) {
         return isOKMessage(message.getDocument());
     }
 
-    public static boolean isOKMessage(final Document document) throws NetconfDocumentedException {
+    public static boolean isOKMessage(final Document document) {
         return isOKMessage(XmlElement.fromDomDocument(document));
     }
 
-    public static boolean isOKMessage(final XmlElement xmlElement) throws NetconfDocumentedException {
+    public static boolean isOKMessage(final XmlElement xmlElement) {
         final var children = xmlElement.getChildElements();
         return children.size() == 1 && children.get(0).getName().equals(XmlNetconfConstants.OK);
     }
 
-    public static boolean isErrorMessage(final NetconfMessage message) throws NetconfDocumentedException {
+    public static boolean isErrorMessage(final NetconfMessage message) {
         return isErrorMessage(message.getDocument());
     }
 
-    public static boolean isErrorMessage(final Document document) throws NetconfDocumentedException {
+    public static boolean isErrorMessage(final Document document) {
         return isErrorMessage(XmlElement.fromDomDocument(document));
     }
 
-    public static boolean isErrorMessage(final XmlElement xmlElement) throws NetconfDocumentedException {
+    public static boolean isErrorMessage(final XmlElement xmlElement) {
         // In the case of multiple rpc-error messages, size will not be 1 but we still want to report as Error
         return xmlElement.getChildElements().stream()
             .anyMatch(result -> DocumentedException.RPC_ERROR.equals(result.getName()));