-
Couldn't load subscription status.
- Fork 38.8k
Description
Situation
I've had the situation that a @Controller was defined with @RequestMapping("/*") to manage all request for that Dispatcher (that already defined urlPatterns="/main/something/*" to distinguish from other dispatcher).
Now, when the Dispatcher was initializing it was throwing StringIndexOutOfBoundsException for a method in that Controller with a @GetMapping(value = "/x/{val}") mapping defined.
*Root cause
I could drill this down to PathPattern:combine ... also reproducible by adding this case to spring-web/src/test/java/org/springframework/web/util/pattern/PathPatternTests.java:combine
assertThat(pathMatcher.combine("/*", "/x/y")).isEqualTo("/x/y");
Workaround
Currently I've solved it by defining the @Controller with a @RequestMapping(/**) for matching multiple path segments (as I assume it's intended).
Enhancement
I am unsure whether it's
- an enhancement request for a better exception OR
- a bug in
combinewhen instead ofendsWithSeparatorWildcardit's equal to the wildcard
:)