Skip to content

Commit bfc3547

Browse files
committed
Fix to show log message 'not contain cached feature flag names' for consumer mode
1 parent 2e5b919 commit bfc3547

File tree

8 files changed

+23
-9
lines changed

8 files changed

+23
-9
lines changed

client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>io.split.client</groupId>
77
<artifactId>java-client-parent</artifactId>
8-
<version>4.10.2-rc1</version>
8+
<version>4.10.2-rc2</version>
99
</parent>
1010
<artifactId>java-client</artifactId>
1111
<packaging>jar</packaging>

client/src/main/java/io/split/client/SplitClientImpl.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,7 @@ private Map<String, SplitResult> getTreatmentsBySetsWithConfigInternal(String ma
414414
List<String> featureFlagNames = new ArrayList<>();
415415
try {
416416
checkSDKReady(methodEnum);
417-
featureFlagNames = getAllFlags(cleanFlagSets);
418-
Map<String, SplitResult> result = validateBeforeEvaluate(featureFlagNames, matchingKey, methodEnum,bucketingKey);
417+
Map<String, SplitResult> result = validateBeforeEvaluateByFlagSets(matchingKey, methodEnum,bucketingKey);
419418
if(result != null) {
420419
return result;
421420
}
@@ -457,6 +456,20 @@ private Map<String, SplitResult> processEvaluatorResult(Map<String, EvaluatorImp
457456
return result;
458457
}
459458

459+
private Map<String, SplitResult> validateBeforeEvaluateByFlagSets(String matchingKey, MethodEnum methodEnum,
460+
String bucketingKey) {
461+
if (_container.isDestroyed()) {
462+
_log.error(CLIENT_DESTROY);
463+
return new HashMap<>();
464+
}
465+
if (!KeyValidator.isValid(matchingKey, "matchingKey", _config.maxStringLength(), methodEnum.getMethod())) {
466+
return new HashMap<>();
467+
}
468+
if (!KeyValidator.bucketingKeyIsValid(bucketingKey, _config.maxStringLength(), methodEnum.getMethod())) {
469+
return new HashMap<>();
470+
}
471+
return null;
472+
}
460473
private Map<String, SplitResult> validateBeforeEvaluate(List<String> featureFlagNames, String matchingKey, MethodEnum methodEnum,
461474
String bucketingKey) {
462475
if (_container.isDestroyed()) {

client/src/main/java/io/split/engine/evaluator/EvaluatorImp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ private List<String> getFeatureFlagNamesByFlagSets(List<String> flagSets) {
6363
Map<String, HashSet<String>> namesByFlagSets = _splitCacheConsumer.getNamesByFlagSets(flagSets);
6464
for (String set: flagSets) {
6565
HashSet<String> flags = namesByFlagSets.get(set);
66-
if (flags == null) {
66+
if (flags == null || flags.isEmpty()) {
6767
_log.warn(String.format("You passed %s Flag Set that does not contain cached feature flag names, please double check " +
6868
"what Flag Sets are in use in the Split user interface.", set));
6969
continue;

client/src/test/java/io/split/engine/evaluator/EvaluatorTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,10 @@ public void evaluateWithWhitelistConditionReturnTreatment() {
153153
@Test
154154
public void evaluateWithSets() {
155155
ParsedSplit split = ParsedSplit.createParsedSplitForTests(SPLIT_NAME, 0, false, DEFAULT_TREATMENT_VALUE, _conditions, TRAFFIC_TYPE_VALUE, CHANGE_NUMBER, 2, new HashSet<>(Arrays.asList("set1", "set2")));
156-
List<String> sets = new ArrayList<>(Arrays.asList("set1"));
156+
List<String> sets = new ArrayList<>(Arrays.asList("set1", "empty_set"));
157157
Map<String, HashSet<String>> flagSets = new HashMap<>();
158158
flagSets.put("set1", new HashSet<>(Arrays.asList(SPLIT_NAME)));
159+
flagSets.put("empty_set", null);
159160
Mockito.when(_splitCacheConsumer.getNamesByFlagSets(sets)).thenReturn(flagSets);
160161
Map<String, ParsedSplit> parsedSplits = new HashMap<>();
161162
parsedSplits.put(SPLIT_NAME, split);

pluggable-storage/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<artifactId>java-client-parent</artifactId>
88
<groupId>io.split.client</groupId>
9-
<version>4.10.2-rc1</version>
9+
<version>4.10.2-rc2</version>
1010
</parent>
1111

1212
<version>2.1.0</version>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>io.split.client</groupId>
66
<artifactId>java-client-parent</artifactId>
7-
<version>4.10.2-rc1</version>
7+
<version>4.10.2-rc2</version>
88
<dependencyManagement>
99
<dependencies>
1010
<dependency>

redis-wrapper/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<artifactId>java-client-parent</artifactId>
88
<groupId>io.split.client</groupId>
9-
<version>4.10.2-rc1</version>
9+
<version>4.10.2-rc2</version>
1010
</parent>
1111
<artifactId>redis-wrapper</artifactId>
1212
<version>3.1.0</version>

testing/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>io.split.client</groupId>
77
<artifactId>java-client-parent</artifactId>
8-
<version>4.10.2-rc1</version>
8+
<version>4.10.2-rc2</version>
99
</parent>
1010
<artifactId>java-client-testing</artifactId>
1111
<packaging>jar</packaging>

0 commit comments

Comments
 (0)