Skip to content

Commit 6d1f117

Browse files
committed
Polishing contribution
Closes gh-33085
1 parent 83fcdfb commit 6d1f117

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

spring-core/src/main/java/org/springframework/util/AntPathMatcher.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -659,7 +659,7 @@ protected static class AntPathStringMatcher {
659659

660660
private final List<String> variableNames = new ArrayList<>();
661661

662-
public AntPathStringMatcher(String pattern, String pathSeparator, boolean caseSensitive) {
662+
protected AntPathStringMatcher(String pattern, String pathSeparator, boolean caseSensitive) {
663663
this.rawPattern = pattern;
664664
this.caseSensitive = caseSensitive;
665665
StringBuilder patternBuilder = new StringBuilder();
@@ -705,7 +705,8 @@ else if (match.startsWith("{") && match.endsWith("}")) {
705705
}
706706

707707
private static Pattern getGlobPattern(String pathSeparator) {
708-
return Pattern.compile(String.format("\\?|\\*|\\{((?:\\{[^%s]+?\\}|[^%s{}]|\\\\[{}])+?)\\}", pathSeparator, pathSeparator));
708+
String pattern = "\\?|\\*|\\{((?:\\{[^" + pathSeparator + "]+?\\}|[^" + pathSeparator + "{}]|\\\\[{}])+?)\\}";
709+
return Pattern.compile(pattern);
709710
}
710711

711712
private String quote(String s, int start, int end) {

0 commit comments

Comments
 (0)