diff --git a/plugins/workload-management/src/main/java/org/opensearch/plugin/wlm/rule/structure/RuleAttributeTrie.java b/plugins/workload-management/src/main/java/org/opensearch/plugin/wlm/rule/structure/RuleAttributeTrie.java index a471e69f85e98..9b9a5d03ba8dd 100644 --- a/plugins/workload-management/src/main/java/org/opensearch/plugin/wlm/rule/structure/RuleAttributeTrie.java +++ b/plugins/workload-management/src/main/java/org/opensearch/plugin/wlm/rule/structure/RuleAttributeTrie.java @@ -38,7 +38,7 @@ public void insert(String key, String value) { } private boolean isValidValue(String value) { - return ALLOWED_ATTRIBUTE_VALUES.matches(value); + return value.matches(ALLOWED_ATTRIBUTE_VALUES); } /** diff --git a/plugins/workload-management/src/test/java/org/opensearch/plugin/wlm/rule/structure/FastPrefixMatchingStructureTests.java b/plugins/workload-management/src/test/java/org/opensearch/plugin/wlm/rule/structure/FastPrefixMatchingStructureTests.java index fa8425e494b8e..4c81987143d60 100644 --- a/plugins/workload-management/src/test/java/org/opensearch/plugin/wlm/rule/structure/FastPrefixMatchingStructureTests.java +++ b/plugins/workload-management/src/test/java/org/opensearch/plugin/wlm/rule/structure/FastPrefixMatchingStructureTests.java @@ -157,11 +157,6 @@ public void testInsertAndSearchEmptyString() { assertEquals(Collections.singletonList("empty"), trie.search("")); } - @Test - public void testInsertEmptyValue() { - trie.insert("emptyvalue", ""); - assertEquals(Collections.singletonList(""), trie.search("emptyvalue")); - } @Test public void testDeleteEmptyString() {