未验证 提交 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 { ...@@ -142,18 +142,20 @@ public class MessageExt extends Message {
} }
public String getBornHostString() { public String getBornHostString() {
if (this.bornHost != null) { if (null != this.bornHost) {
InetSocketAddress inetSocketAddress = (InetSocketAddress) this.bornHost; InetAddress inetAddress = ((InetSocketAddress) this.bornHost).getAddress();
return inetSocketAddress.getAddress().getHostAddress();
return null != inetAddress ? inetAddress.getHostAddress() : null;
} }
return null; return null;
} }
public String getBornHostNameString() { public String getBornHostNameString() {
if (this.bornHost != null) { if (null != this.bornHost) {
InetSocketAddress inetSocketAddress = (InetSocketAddress) this.bornHost; InetAddress inetAddress = ((InetSocketAddress) this.bornHost).getAddress();
return inetSocketAddress.getAddress().getHostName();
return null != inetAddress ? inetAddress.getHostName() : null;
} }
return null; return null;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册