Skip to content

Commit 6f1ea89

Browse files
committed
apply PR suggestions
1 parent a8ff152 commit 6f1ea89

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

internal-api/src/main/java/datadog/trace/bootstrap/config/provider/StableConfigParser.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import java.util.Collections;
1313
import java.util.LinkedHashMap;
1414
import java.util.List;
15+
import java.util.Locale;
1516
import java.util.Map;
1617
import org.slf4j.Logger;
1718
import org.slf4j.LoggerFactory;
@@ -104,23 +105,21 @@ private static boolean doesRuleMatch(Rule rule) {
104105
}
105106

106107
private static boolean matchOperator(String value, String operator, List<String> matches) {
107-
// not sure if these are nullable, but the semantics makes sense
108-
// and that will save us from a NPE
109108
if (value == null || operator == null) {
110109
return false;
111110
}
112111
if ("exist".equals(operator)) {
113112
return true;
114113
}
115-
if (matches == null) {
114+
if (matches.isEmpty()) {
116115
return false;
117116
}
118-
value = value.toLowerCase();
117+
value = value.toLowerCase(Locale.ROOT);
119118
for (String match : matches) {
120119
if (match == null) {
121120
continue;
122121
}
123-
match = match.toLowerCase();
122+
match = match.toLowerCase(Locale.ROOT);
124123
switch (operator) {
125124
case "equals":
126125
return value.equals(match);
@@ -146,7 +145,7 @@ static boolean selectorMatch(String origin, List<String> matches, String operato
146145
operator = operator.toLowerCase();
147146
switch (origin.toLowerCase()) {
148147
case "language":
149-
if (operator.equals("exists")) {
148+
if ("exists".equals(operator)) {
150149
return false;
151150
}
152151
return matchOperator("java", operator, matches);

0 commit comments

Comments
 (0)