Simplified match condition checks

Issue: SPR-15477
This commit is contained in:
Juergen Hoeller
2017-04-27 21:31:50 +02:00
parent 17f274fd6a
commit baa7b1c6c8

View File

@@ -220,8 +220,7 @@ public class AntPathMatcher implements PathMatcher {
if (pathIdxStart > pathIdxEnd) { if (pathIdxStart > pathIdxEnd) {
// Path is exhausted, only match if rest of pattern is * or **'s // Path is exhausted, only match if rest of pattern is * or **'s
if (pattIdxStart > pattIdxEnd) { if (pattIdxStart > pattIdxEnd) {
return (pattern.endsWith(this.pathSeparator) ? path.endsWith(this.pathSeparator) : return (pattern.endsWith(this.pathSeparator) == path.endsWith(this.pathSeparator));
!path.endsWith(this.pathSeparator));
} }
if (!fullMatch) { if (!fullMatch) {
return true; return true;
@@ -324,10 +323,7 @@ public class AntPathMatcher implements PathMatcher {
pos += skipped; pos += skipped;
skipped = skipSegment(path, pos, pattDir); skipped = skipSegment(path, pos, pattDir);
if (skipped < pattDir.length()) { if (skipped < pattDir.length()) {
if (skipped > 0) { return (skipped > 0 || (pattDir.length() > 0 && isWildcardChar(pattDir.charAt(0))));
return true;
}
return (pattDir.length() > 0) && isWildcardChar(pattDir.charAt(0));
} }
pos += skipped; pos += skipped;
} }