Skip to content

Commit

Permalink
Fix the npe issue for old version of gray release rules (#4382)
Browse files Browse the repository at this point in the history
  • Loading branch information
nobodyiam authored May 27, 2022
1 parent f929541 commit cd77fd5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
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

0 comments on commit cd77fd5

Please sign in to comment.