-
Notifications
You must be signed in to change notification settings - Fork 26.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix localAddress may be null,avoid throwing NullPointerException(#7621) #7622
Conversation
Codecov Report
@@ Coverage Diff @@
## master #7622 +/- ##
============================================
+ Coverage 59.11% 59.14% +0.03%
- Complexity 528 529 +1
============================================
Files 1076 1076
Lines 43443 43445 +2
Branches 6346 6347 +1
============================================
+ Hits 25681 25697 +16
+ Misses 14917 14916 -1
+ Partials 2845 2832 -13 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked the code. If LOCAL_ADDRESS is empty and throws an exception, the previous logic is changed: in the getLocalHost method, if LOCAL_ADDRESS is empty, it will return a LOCALHOST_VALUE.
But the return value of getLocalAddress method is localAddress, not LOCAL_ADDRESS, and getIpByHost(getLocalAddress().getHostName()) will be called in getIpByConfig(), and NullPointerException will be thrown here |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
…che#7622) * Fix localAddress may be null,avoid throwing NullPointerException(apache#7621) * Update by review Co-authored-by: xingrufei <xingrufei@sogou-inc.com>
What is the purpose of the change
Fix localAddress may be null,and NullPointerException will be thrown in NetUtils
In this issue(#7621 ), this pr is to fix this issue, to avoid throwing NullPointerException in NetUtils, thanks
Brief changelog
Verifying this change
[Dubbo-XXX] Fix UnknownException when host config not exist #XXX
. Each commit in the pull request should have a meaningful subject line and body.mvn clean install -DskipTests=false
&mvn clean test-compile failsafe:integration-test
to make sure unit-test and integration-test pass.