Merge "Log the address and port when binding fails"
authorAnil Vishnoi <vishnoianil@gmail.com>
Thu, 10 Jan 2019 17:17:51 +0000 (17:17 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 10 Jan 2019 17:17:51 +0000 (17:17 +0000)
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/TcpHandler.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/UdpHandler.java

index 46dfd14d40cbec1b26c3407f8ac3ac04af3d25d4..288c58c92968612ad31f8117c7b2204d0351aa6a 100644 (file)
@@ -86,6 +86,7 @@ public class TcpHandler implements ServerFacade {
      * Starts server on selected port.
      */
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public void run() {
         /*
          * We generally do not perform IO-unrelated tasks, so we want to have
@@ -121,6 +122,10 @@ public class TcpHandler implements ServerFacade {
         } catch (InterruptedException e) {
             LOG.error("Interrupted while binding port {}", port, e);
             return;
+        } catch (Throwable throwable) {
+            // sync() re-throws exceptions declared as Throwable, so the compiler doesn't see them
+            LOG.error("Error while binding address {} and port {}", startupAddress, port, throwable);
+            throw throwable;
         }
 
         try {
index 32f164be9c8b5342c43eacdef9f5f58e74ab50ce..0fef5d45399fdf67b956d48d296b9b1423836617 100644 (file)
@@ -65,6 +65,7 @@ public final class UdpHandler implements ServerFacade {
     }
 
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public void run() {
         final ChannelFuture f;
         try {
@@ -80,6 +81,10 @@ public final class UdpHandler implements ServerFacade {
         } catch (InterruptedException e) {
             LOG.error("Interrupted while binding port {}", port, e);
             return;
+        } catch (Throwable throwable) {
+            // sync() re-throws exceptions declared as Throwable, so the compiler doesn't see them
+            LOG.error("Error while binding address {} and port {}", startupAddress, port, throwable);
+            throw throwable;
         }
 
         try {