From baa7b1c6c84f64465cecdf6ad2e2bf90371cbd7b Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Thu, 27 Apr 2017 21:31:50 +0200 Subject: [PATCH] Simplified match condition checks Issue: SPR-15477 --- .../java/org/springframework/util/AntPathMatcher.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/util/AntPathMatcher.java b/spring-core/src/main/java/org/springframework/util/AntPathMatcher.java index f63563751ce..f572eb051b9 100644 --- a/spring-core/src/main/java/org/springframework/util/AntPathMatcher.java +++ b/spring-core/src/main/java/org/springframework/util/AntPathMatcher.java @@ -220,8 +220,7 @@ public class AntPathMatcher implements PathMatcher { if (pathIdxStart > pathIdxEnd) { // Path is exhausted, only match if rest of pattern is * or **'s if (pattIdxStart > pattIdxEnd) { - return (pattern.endsWith(this.pathSeparator) ? path.endsWith(this.pathSeparator) : - !path.endsWith(this.pathSeparator)); + return (pattern.endsWith(this.pathSeparator) == path.endsWith(this.pathSeparator)); } if (!fullMatch) { return true; @@ -324,10 +323,7 @@ public class AntPathMatcher implements PathMatcher { pos += skipped; skipped = skipSegment(path, pos, pattDir); if (skipped < pattDir.length()) { - if (skipped > 0) { - return true; - } - return (pattDir.length() > 0) && isWildcardChar(pattDir.charAt(0)); + return (skipped > 0 || (pattDir.length() > 0 && isWildcardChar(pattDir.charAt(0)))); } pos += skipped; }