if sub server cannot be bound, log it as warning

This commit is contained in:
Vladimir Krivosheev
2013-10-21 17:13:19 +02:00
parent 3c0f475294
commit ae8bbe6dd1
2 changed files with 9 additions and 3 deletions
@@ -33,6 +33,7 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.ide.PooledThreadExecutor;
import java.io.IOException;
import java.net.BindException;
import java.net.InetSocketAddress;
import java.net.Socket;
@@ -93,7 +94,8 @@ public final class NettyUtil {
}
return (throwable instanceof IOException && message.equals("An existing connection was forcibly closed by the remote host")) ||
(throwable instanceof ChannelException && message.startsWith("Failed to bind to: "));
(throwable instanceof ChannelException && message.startsWith("Failed to bind to: ")) ||
throwable instanceof BindException;
}
// applicable only in case of ClientBootstrap&OioClientSocketChannelFactory
@@ -47,8 +47,12 @@ final class SubServer implements CustomPortServerManager.CustomPortService, Disp
return true;
}
catch (Exception e) {
NettyUtil.log(e, BuiltInServer.LOG);
user.cannotBind(e, port);
try {
NettyUtil.log(e, BuiltInServer.LOG);
}
finally {
user.cannotBind(e, port);
}
return false;
}
}