Skip to content

Commit baa7b1c

Browse files
committed
Simplified match condition checks
Issue: SPR-15477
1 parent 17f274f commit baa7b1c

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,7 @@ protected boolean doMatch(String pattern, String path, boolean fullMatch, Map<St
220220
if (pathIdxStart > pathIdxEnd) {
221221
// Path is exhausted, only match if rest of pattern is * or **'s
222222
if (pattIdxStart > pattIdxEnd) {
223-
return (pattern.endsWith(this.pathSeparator) ? path.endsWith(this.pathSeparator) :
224-
!path.endsWith(this.pathSeparator));
223+
return (pattern.endsWith(this.pathSeparator) == path.endsWith(this.pathSeparator));
225224
}
226225
if (!fullMatch) {
227226
return true;
@@ -324,10 +323,7 @@ private boolean isPotentialMatch(String path, String[] pattDirs) {
324323
pos += skipped;
325324
skipped = skipSegment(path, pos, pattDir);
326325
if (skipped < pattDir.length()) {
327-
if (skipped > 0) {
328-
return true;
329-
}
330-
return (pattDir.length() > 0) && isWildcardChar(pattDir.charAt(0));
326+
return (skipped > 0 || (pattDir.length() > 0 && isWildcardChar(pattDir.charAt(0))));
331327
}
332328
pos += skipped;
333329
}

0 commit comments

Comments
 (0)