You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/05/11 02:48:12 UTC
[dubbo] branch master updated: fix getAddress will cause npe
problem. (#7711)
This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 2c471f9 fix getAddress will cause npe problem. (#7711)
2c471f9 is described below
commit 2c471f912d4b9b8d90baf6a656e1e79741e85b35
Author: 赵延 <10...@qq.com>
AuthorDate: Tue May 11 10:47:56 2021 +0800
fix getAddress will cause npe problem. (#7711)
---
.../java/org/apache/dubbo/registry/client/DefaultServiceInstance.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/DefaultServiceInstance.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/DefaultServiceInstance.java
index 2cd28ea..60c52d7 100644
--- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/DefaultServiceInstance.java
+++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/DefaultServiceInstance.java
@@ -115,8 +115,8 @@ public class DefaultServiceInstance implements ServiceInstance {
return address;
}
- private static String getAddress(String host, int port) {
- return port <= 0 ? host : host + ':' + port;
+ private static String getAddress(String host, Integer port) {
+ return port != null && port <= 0 ? host : host + ':' + port;
}
@Override