Skip to content
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 the npe issue for old version of gray release rules #4382

Merged
merged 1 commit into from
May 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ Apollo 2.0.1
------------------
* [Upgrade spring boot to fix search user issue](https://github.com/apolloconfig/apollo/pull/4366)
* [Fix search user duplication issue](https://github.com/apolloconfig/apollo/pull/4371)
* [Fix the npe issue for old version of gray release rules](https://github.com/apolloconfig/apollo/pull/4382)
------------------
All issues and pull requests are [here](https://github.com/apolloconfig/apollo/milestone/12?closed=1)
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void testUpdateBranchGrayRulesWithUpdateTwice() {
namespaceBranchService.updateBranchGrayRules(testApp, testCluster, testNamespace, testBranchName, firstRule);

GrayReleaseRule secondRule = instanceGrayReleaseRule();
secondRule.setRules("[{\"clientAppId\":\"branch-test\",\"clientIpList\":[\"10.38.57.112\"]}]");
secondRule.setRules("[{\"clientAppId\":\"branch-test\",\"clientIpList\":[\"10.38.57.112\"],\"clientLabelList\":[\"branch-test\"]}]");
namespaceBranchService.updateBranchGrayRules(testApp, testCluster, testNamespace, testBranchName, secondRule);

GrayReleaseRule
Expand Down Expand Up @@ -200,7 +200,7 @@ private GrayReleaseRule instanceGrayReleaseRule() {
rule.setNamespaceName(testNamespace);
rule.setBranchName(testBranchName);
rule.setBranchStatus(NamespaceBranchStatus.ACTIVE);
rule.setRules("[{\"clientAppId\":\"test\",\"clientIpList\":[\"1.0.0.4\"]}]");
rule.setRules("[{\"clientAppId\":\"test\",\"clientIpList\":[\"1.0.0.4\"],\"clientLabelList\":[]}]");
return rule;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public class GrayReleaseRuleItemDTO {
private Set<String> clientIpList;
private Set<String> clientLabelList;

// this default constructor is for json deserialize use, to make sure all fields are initialized
public GrayReleaseRuleItemDTO() {
this("");
}

public GrayReleaseRuleItemDTO(String clientAppId) {
this(clientAppId, Sets.newHashSet(), Sets.newHashSet());
}
Expand Down