Skip to content

AntPatternComparator prefers a less specific match when brackets occur [SPR-8355] #13002

@spring-projects-issues

Description

@spring-projects-issues

Johnathon opened SPR-8355 and commented

When sorting the following array: [/a/b/{c}/, /a/b/{c}//, /, //] with the current implementation of AntPathMatcher.AntPatternComparator, the sort order results in: [//, /, /a/b/{c}//, /a/b/{c}/] . In our case, this results in the wrong controller picking up the request.

I believe the problem lies in this block:
if (totalCount1 != totalCount2) {
return totalCount1 - totalCount2;
}
and would be correct if instead it returned "totalCount2 - totalCount1;". However, I can't speak to how this may affect other use cases.


Affects: 3.0.4, 3.0.5

Issue Links:

3 votes, 3 watchers

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: duplicateA duplicate of another issue

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions