Buggy code:
public class AnnotationMethodHandlerAdapter extends WebContentGenerator implements BeanFactoryAware , Ordered , HandlerAdapter { public static final String PAGE_NOT_FOUND_LOG_CATEGORY = "org.springframework.web.servlet.PageNotFound" ; protected static final Log pageNotFoundLogger = LogFactory . getLog ( AnnotationMethodHandlerAdapter . PAGE_NOT_FOUND_LOG_CATEGORY ) ; private UrlPathHelper urlPathHelper = new UrlPathHelper ( ) ; private PathMatcher pathMatcher = new AntPathMatcher ( ) ; private MethodNameResolver methodNameResolver = new InternalPathMethodNameResolver ( ) ; private WebBindingInitializer webBindingInitializer ; private SessionAttributeStore sessionAttributeStore = new DefaultSessionAttributeStore ( ) ; private int cacheSecondsForSessionAttributeHandlers = 0 ; private boolean synchronizeOnSession = false ; private ParameterNameDiscoverer parameterNameDiscoverer = new LocalVariableTableParameterNameDiscoverer ( ) ; private WebArgumentResolver [ ] customArgumentResolvers ; private ModelAndViewResolver [ ] customModelAndViewResolvers ; private HttpMessageConverter < ? > [ ] messageConverters = new HttpMessageConverter [ ] { new ByteArrayHttpMessageConverter ( ) , new StringHttpMessageConverter ( ) , new FormHttpMessageConverter ( ) , new SourceHttpMessageConverter ( ) } ; private int order = Ordered . LOWEST_PRECEDENCE ; private ConfigurableBeanFactory beanFactory ; private BeanExpressionContext expressionContext ; private final Map < Class < ? > , AnnotationMethodHandlerAdapter . ServletHandlerMethodResolver > methodResolverCache = new ConcurrentHashMap < Class < ? > , AnnotationMethodHandlerAdapter . ServletHandlerMethodResolver > ( ) ; public AnnotationMethodHandlerAdapter ( ) { } public void setAlwaysUseFullPath ( boolean alwaysUseFullPath ) { } public void setUrlDecode ( boolean urlDecode ) { } public void setUrlPathHelper ( UrlPathHelper urlPathHelper ) { } public void setPathMatcher ( PathMatcher pathMatcher ) { } public void setMethodNameResolver ( MethodNameResolver methodNameResolver ) { } public void setWebBindingInitializer ( WebBindingInitializer webBindingInitializer ) { } public void setSessionAttributeStore ( SessionAttributeStore sessionAttributeStore ) { } public void setCacheSecondsForSessionAttributeHandlers ( int cacheSecondsForSessionAttributeHandlers ) { } public void setSynchronizeOnSession ( boolean synchronizeOnSession ) { } public void setParameterNameDiscoverer ( ParameterNameDiscoverer parameterNameDiscoverer ) { } public void setCustomArgumentResolver ( WebArgumentResolver argumentResolver ) { } public void setCustomArgumentResolvers ( WebArgumentResolver [ ] argumentResolvers ) { } public void setCustomModelAndViewResolver ( ModelAndViewResolver customModelAndViewResolver ) { } public void setCustomModelAndViewResolvers ( ModelAndViewResolver [ ] customModelAndViewResolvers ) { } public void setMessageConverters ( HttpMessageConverter < ? > [ ] messageConverters ) { } public HttpMessageConverter < ? > [ ] getMessageConverters ( ) { } public void setOrder ( int order ) { } public int getOrder ( ) { } public void setBeanFactory ( BeanFactory beanFactory ) { } public boolean supports ( Object handler ) { } public ModelAndView handle ( HttpServletRequest request , HttpServletResponse response , Object handler ) throws Exception { } protected ModelAndView invokeHandlerMethod ( HttpServletRequest request , HttpServletResponse response , Object handler ) throws Exception { } public long getLastModified ( HttpServletRequest request , Object handler ) { } private AnnotationMethodHandlerAdapter . ServletHandlerMethodResolver getMethodResolver ( Object handler ) { } protected ServletRequestDataBinder createBinder ( HttpServletRequest request , Object target , String objectName ) throws Exception { } private class ServletHandlerMethodResolver extends HandlerMethodResolver { private ServletHandlerMethodResolver ( Class < ? > handlerType ) { } public Method resolveHandlerMethod ( HttpServletRequest request ) throws ServletException { } private String getMatchedPattern ( String methodLevelPattern , String lookupPath , HttpServletRequest request ) { if ( ( hasTypeLevelMapping ( ) ) && ( ! ( ObjectUtils . isEmpty ( getTypeLevelMapping ( ) . value ( ) ) ) ) ) { String [ ] typeLevelPatterns = getTypeLevelMapping ( ) . value ( ) ; for ( String typeLevelPattern : typeLevelPatterns ) { if ( ! ( typeLevelPattern . startsWith ( "//" ) ) ) { typeLevelPattern = "//" + typeLevelPattern ; } String combinedPattern = pathMatcher . combine ( typeLevelPattern , methodLevelPattern ) ; if ( isPathMatchInternal ( combinedPattern , lookupPath ) ) { return combinedPattern ; } } return null ; } String bestMatchingPattern = ( ( String ) ( request . getAttribute ( BEST_MATCHING_PATTERN_ATTRIBUTE ) ) ) ; <START_BUG> if ( StringUtils . hasText ( bestMatchingPattern ) ) { <END_BUG> String combinedPattern = pathMatcher . combine ( bestMatchingPattern , methodLevelPattern ) ; if ( ( ! ( combinedPattern . equals ( bestMatchingPattern ) ) ) && ( isPathMatchInternal ( combinedPattern , lookupPath ) ) ) { return combinedPattern ; } } if ( isPathMatchInternal ( methodLevelPattern , lookupPath ) ) { return methodLevelPattern ; } return null ; } private boolean isPathMatchInternal ( String pattern , String lookupPath ) { } @ SuppressWarnings ( "unchecked" ) private void extractHandlerMethodUriTemplates ( String mappedPath , String lookupPath , HttpServletRequest request ) { } } private class ServletHandlerMethodInvoker extends HandlerMethodInvoker { private boolean responseArgumentUsed = false ; private ServletHandlerMethodInvoker ( HandlerMethodResolver resolver ) { } @ Override protected void raiseMissingParameterException ( String paramName , Class paramType ) throws Exception { } @ Override protected void raiseSessionRequiredException ( String message ) throws Exception { } @ Override protected WebDataBinder createBinder ( NativeWebRequest webRequest , Object target , String objectName ) throws Exception { } @ Override protected void doBind ( WebDataBinder binder , NativeWebRequest webRequest ) throws Exception { } @ Override protected HttpInputMessage createHttpInputMessage ( NativeWebRequest webRequest ) throws Exception { } @ Override protected Object resolveDefaultValue ( String value ) { } @ Override protected Object resolveCookieValue ( String cookieName , Class paramType , NativeWebRequest webRequest ) throws Exception { } @ Override @ SuppressWarnings ( { "unchecked" } ) protected String resolvePathVariable ( String pathVarName , Class paramType , NativeWebRequest webRequest ) throws Exception { } @ Override protected Object resolveStandardArgument ( Class parameterType , NativeWebRequest webRequest ) throws Exception { } @ SuppressWarnings ( "unchecked" ) public ModelAndView getModelAndView ( Method handlerMethod , Class handlerType , Object returnValue , ExtendedModelMap implicitModel , ServletWebRequest webRequest ) throws Exception { } @ SuppressWarnings ( "unchecked" ) private void handleResponseBody ( Object returnValue , ServletWebRequest webRequest ) throws IOException , ServletException { } } static class RequestMappingInfo { String [ ] paths = new String [ 0 ] ; List < String > matchedPaths = Collections . emptyList ( ) ; RequestMethod [ ] methods = new RequestMethod [ 0 ] ; String [ ] params = new String [ 0 ] ; String [ ] headers = new String [ 0 ] ;

Fix:
if ( ( StringUtils . hasText ( bestMatchingPattern ) ) && ( bestMatchingPattern . endsWith ( "*" ) ) ) {