-
Notifications
You must be signed in to change notification settings - Fork 26.4k
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
Code review config center #3096
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3096 +/- ##
============================================
- Coverage 63.6% 63.54% -0.06%
Complexity 75 75
============================================
Files 653 652 -1
Lines 28218 28186 -32
Branches 4803 4792 -11
============================================
- Hits 17947 17911 -36
- Misses 8002 8016 +14
+ Partials 2269 2259 -10
Continue to review full report at Codecov.
|
@@ -45,7 +45,10 @@ public Object getProperty(String key, Object defaultValue) { | |||
value = getInternalProperty(prefix + key); | |||
} | |||
if (value == null) { |
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.
Can be simplified with
if (value == null) {
value = getInternalProperty(key);
}
return value!=null? value:defaultValue;
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.
done
if (value == null) { | ||
value = defaultValue; | ||
} | ||
return value; |
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.
can be simplified with
return value!=null? value : defaultValue?
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.
done
key = key.substring(0, i) + "/" + key.substring(i + 1); | ||
public Object getInternalProperty(String key) { | ||
ChildData childData = treeCache.getCurrentData(key); | ||
if (childData != null) { |
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.
can be simplified with
return childData!=null ?return new String(childData.getData(), StandardCharsets.UTF_8) :null;
return null; | ||
// when group is null, we are fetching governance rules. | ||
// for example, key=org.apache.dubbo.DemoService.configurators | ||
else { |
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.
is there any possibility of key having null?
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.
In reality, key passed to here will never be null.
@@ -56,7 +56,7 @@ public void addConfiguration(int pos, Configuration configuration) { | |||
} | |||
|
|||
@Override | |||
protected Object getInternalProperty(String key) { | |||
public Object getInternalProperty(String key) { | |||
Configuration firstMatchingConfiguration = null; | |||
for (Configuration config : configList) { | |||
try { |
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.
Is it better to do a non-empty check and remove the try block?
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.
Changed the behaviour to print log.
* polish javadoc * git rid of template class for apollo * get rid of template class for NopDynamicConfiguration * get rid of tempate class for ZookeeperDynamicConfiguration * get rid of AbstractDynamicConfiguration * get rid of AbstractConfiguration * fix compilation error * fix compilation error * polish code
What is the purpose of the change
XXXXX
Brief changelog
XXXXX
Verifying this change
XXXXX
Follow this checklist to help us incorporate your contribution quickly and easily:
[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.