Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-7765

URITemplate.compareTemplates returns inconsistent results

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.15
    • Fix Version/s: 3.2.6, 3.1.17
    • Component/s: JAX-RS
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      When org.apache.cxf.jaxrs.model.URITemplate.compareTemplates() is passed two templates with the same number of literal characters, it returns -1 regardless of the order the templates a passed in. I suppose this may be on purpose, but the result is that if compareTemplates() is used as the basis of a Comparator<URITemplate> that is used by java.util.Collections.sort() it can result in:

      java.lang.IllegalArgumentException: Comparison method violates its general contract!

      I would also expect that this would result in some degree of unpredictability of the prioritization of when selecting the appropriate JAX-RS method to call for a given request.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                coheigea Colm O hEigeartaigh
                Reporter:
                svella Shon Vella
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: