未验证 提交 41ce16bb 编写于 作者: R rongtong 提交者: GitHub

Merge pull request #2040 from lebron374/npe_fix_v1

[ISSUE #1798] Fix MessageExt#getBornHostString NPE
......@@ -142,18 +142,20 @@ public class MessageExt extends Message {
}
public String getBornHostString() {
if (this.bornHost != null) {
InetSocketAddress inetSocketAddress = (InetSocketAddress) this.bornHost;
return inetSocketAddress.getAddress().getHostAddress();
if (null != this.bornHost) {
InetAddress inetAddress = ((InetSocketAddress) this.bornHost).getAddress();
return null != inetAddress ? inetAddress.getHostAddress() : null;
}
return null;
}
public String getBornHostNameString() {
if (this.bornHost != null) {
InetSocketAddress inetSocketAddress = (InetSocketAddress) this.bornHost;
return inetSocketAddress.getAddress().getHostName();
if (null != this.bornHost) {
InetAddress inetAddress = ((InetSocketAddress) this.bornHost).getAddress();
return null != inetAddress ? inetAddress.getHostName() : null;
}
return null;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册