Buggy code:
public class AntPathMatcher implements PathMatcher { public static final String DEFAULT_PATH_SEPARATOR = "//" ; private static final int CACHE_TURNOFF_THRESHOLD = 65536 ; private static final Pattern VARIABLE_PATTERN = Pattern . compile ( "\\{[^//]+?\\}" ) ; private String pathSeparator ; private AntPathMatcher . PathSeparatorPatternCache pathSeparatorPatternCache ; private boolean trimTokens = true ; private volatile Boolean cachePatterns ; private final Map < String , String [ ] > tokenizedPatternCache = new ConcurrentHashMap < String , String [ ] > ( 256 ) ; final Map < String , AntPathMatcher . AntPathStringMatcher > stringMatcherCache = new ConcurrentHashMap < String , AntPathMatcher . AntPathStringMatcher > ( 256 ) ; public AntPathMatcher ( ) { } public AntPathMatcher ( String pathSeparator ) { } public void setPathSeparator ( String pathSeparator ) { } public void setTrimTokens ( boolean trimTokens ) { } public void setCachePatterns ( boolean cachePatterns ) { } private void deactivatePatternCache ( ) { } @ Override public boolean isPattern ( String path ) { } @ Override public boolean match ( String pattern , String path ) { } @ Override public boolean matchStart ( String pattern , String path ) { } protected boolean doMatch ( String pattern , String path , boolean fullMatch , Map < String , String > uriTemplateVariables ) { } protected String [ ] tokenizePattern ( String pattern ) { } protected String [ ] tokenizePath ( String path ) { } private boolean matchStrings ( String pattern , String str , Map < String , String > uriTemplateVariables ) { } protected AntPathMatcher . AntPathStringMatcher getStringMatcher ( String pattern ) { } @ Override public String extractPathWithinPattern ( String pattern , String path ) { } @ Override public Map < String , String > extractUriTemplateVariables ( String pattern , String path ) { } @ Override public String combine ( String pattern1 , String pattern2 ) { } private String concat ( String path1 , String path2 ) { } @ Override public Comparator < String > getPatternComparator ( String path ) { } protected static class AntPathStringMatcher { private static final Pattern GLOB_PATTERN = Pattern . compile ( "\\?|\\*|\\{((?:\\{[^//]+?\\}|[^//{}]|\\\\[{}])+?)\\}" ) ; private static final String DEFAULT_VARIABLE_PATTERN = "(.*)" ; private final Pattern pattern ; private final List < String > variableNames = new LinkedList < String > ( ) ; public AntPathStringMatcher ( String pattern ) { } private String quote ( String s , int start , int end ) { } public boolean matchStrings ( String str , Map < String , String > uriTemplateVariables ) { } } protected static class AntPatternComparator implements Comparator < String > { private final String path ; public AntPatternComparator ( String path ) { } @ Override public int compare ( String pattern1 , String pattern2 ) { } private static class PatternInfo { private final String pattern ; private int uriVars ; private int singleWildcards ; private int doubleWildcards ; private boolean catchAllPattern ; private boolean prefixPattern ; private Integer length ; public PatternInfo ( String pattern ) { } protected void initCounters ( ) { int pos = 0 ; while ( pos < ( this . pattern . length ( ) ) ) { if ( ( this . pattern . charAt ( pos ) ) == '{' ) { ( this . uriVars ) ++ ; pos ++ ; } else if ( ( this . pattern . charAt ( pos ) ) == '*' ) { if ( ( ( pos + 1 ) < ( this . pattern . length ( ) ) ) && ( ( this . pattern . charAt ( ( pos + 1 ) ) ) == '*' ) ) { ( this . doubleWildcards ) ++ ; pos += 2 ; } else <START_BUG> if ( ! ( this . pattern . substring ( ( pos - 1 ) ) . equals ( ".*" ) ) ) { <END_BUG> ( this . singleWildcards ) ++ ; pos ++ ; } else { pos ++ ; } } else { pos ++ ; } } } public int getUriVars ( ) { } public int getSingleWildcards ( ) { } public int getDoubleWildcards ( ) { } public boolean isLeastSpecific ( ) { } public boolean isPrefixPattern ( ) { } public int getTotalCount ( ) { } public int getLength ( ) { } } } private static class PathSeparatorPatternCache { private final String endsOnWildCard ; private final String endsOnDoubleWildCard ; public PathSeparatorPatternCache ( String pathSeparator ) { } public String getEndsOnWildCard ( ) { } public String getEndsOnDoubleWildCard ( ) { } } }

Fix:
if ( ( pos > 0 ) && ( ! ( this . pattern . substring ( ( pos - 1 ) ) . equals ( ".*" ) ) ) ) {