Skip to content

Commit

Permalink
GH-3608: Use Locale.ROOT for neutral, case insensitive comparisons
Browse files Browse the repository at this point in the history
Fixes: #3608
Issue link: #3608

(cherry picked from commit 07cff76)
  • Loading branch information
artembilan authored and spring-builds committed Oct 31, 2024
1 parent 9b3c843 commit ffa49ee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
Expand Down Expand Up @@ -1014,7 +1015,7 @@ else if (resolvedValue instanceof Integer intgr) {
private TopicPartitionOffset.SeekPosition resloveTopicPartitionOffsetSeekPosition(@Nullable Object seekPosition) {
TopicPartitionOffset.SeekPosition resloveTpoSp = null;
if (seekPosition instanceof String seekPositionName) {
String capitalLetterSeekPositionName = seekPositionName.trim().toUpperCase();
String capitalLetterSeekPositionName = seekPositionName.trim().toUpperCase(Locale.ROOT);
if (SeekPosition.BEGINNING.name().equals(capitalLetterSeekPositionName)) {
resloveTpoSp = SeekPosition.BEGINNING;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -351,13 +352,13 @@ protected SimplePatternBasedHeaderMatcher(String pattern) {

SimplePatternBasedHeaderMatcher(String pattern, boolean negate) {
Assert.notNull(pattern, "Pattern must no be null");
this.pattern = pattern.toLowerCase();
this.pattern = pattern.toLowerCase(Locale.ROOT);
this.negate = negate;
}

@Override
public boolean matchHeader(String headerName) {
String header = headerName.toLowerCase();
String header = headerName.toLowerCase(Locale.ROOT);
if (PatternMatchUtils.simpleMatch(this.pattern, header)) {
LOGGER.debug(() ->
MessageFormat.format(
Expand Down

0 comments on commit ffa49ee

Please sign in to comment.