From: Ed Warnicke Date: Tue, 2 Dec 2014 16:21:52 +0000 (+0000) Subject: Merge "Handle more specific BindException and IOException" X-Git-Tag: release/lithium~812 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=7f2ecd54dd3eb09af469a610fdd541b48ed95b80;hp=b52893a2ff963a4a02a96190d78f62e9d261ffce Merge "Handle more specific BindException and IOException" --- diff --git a/opendaylight/netconf/netconf-testtool/src/main/java/org/opendaylight/controller/netconf/test/tool/NetconfDeviceSimulator.java b/opendaylight/netconf/netconf-testtool/src/main/java/org/opendaylight/controller/netconf/test/tool/NetconfDeviceSimulator.java index a45c374eae..c6cad90355 100644 --- a/opendaylight/netconf/netconf-testtool/src/main/java/org/opendaylight/controller/netconf/test/tool/NetconfDeviceSimulator.java +++ b/opendaylight/netconf/netconf-testtool/src/main/java/org/opendaylight/controller/netconf/test/tool/NetconfDeviceSimulator.java @@ -30,6 +30,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.lang.management.ManagementFactory; +import java.net.BindException; import java.net.Inet4Address; import java.net.InetSocketAddress; import java.net.URI; @@ -201,14 +202,17 @@ public class NetconfDeviceSimulator implements Closeable { final SshProxyServer sshServer = new SshProxyServer(minaTimerExecutor, nettyThreadgroup, nioExecutor); sshServer.bind(getSshConfiguration(bindingAddress, tcpLocalAddress)); sshWrappers.add(sshServer); - } catch (final Exception e) { - LOG.warn("Cannot start simulated device on {}, skipping", address, e); + } catch (final BindException e) { + LOG.warn("Cannot start simulated device on {}, port already in use. Skipping.", address); // Close local server and continue server.cancel(true); if(server.isDone()) { server.channel().close(); } continue; + } catch (final IOException e) { + LOG.warn("Cannot start simulated device on {} due to IOException.", address, e); + break; } finally { currentPort++; }