提交 f2810d61 authored 作者: Thomas Mueller's avatar Thomas Mueller

If InetAddress.getLocalHost() fails, the database should now throws an exception.

上级 bd8141a8
......@@ -234,14 +234,22 @@ public class NetUtils {
}
}
InetAddress bind = null;
boolean useLocalhost = false;
try {
bind = getBindAddress();
if (bind == null) {
bind = InetAddress.getLocalHost();
useLocalhost = true;
}
} catch (UnknownHostException e) {
// ignore
}
if (useLocalhost) {
try {
bind = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
throw DbException.convert(e);
}
}
String address = bind == null ? "localhost" : getHostAddress(bind);
if (address.equals("127.0.0.1")) {
address = "localhost";
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论