Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-8355

AntPatternComparator prefers a less specific match when brackets occur

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 3.0.4, 3.0.5
    • Fix Version/s: 4.0 GA
    • Component/s: Core
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bclozel Brian Clozel
                Reporter:
                outdooricon Johnathon
                Last updater:
                Brian Clozel
              • Votes:
                3 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  6 years, 35 weeks, 3 days ago