提交 4feb8cae 编写于 作者: lebron2008lebron's avatar lebron2008lebron

npe fix

上级 0144b03b
...@@ -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.
先完成此消息的编辑!
想要评论请 注册