1212import java .util .Collections ;
1313import java .util .LinkedHashMap ;
1414import java .util .List ;
15+ import java .util .Locale ;
1516import java .util .Map ;
1617import org .slf4j .Logger ;
1718import 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