You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Shon Vella (JIRA)" <ji...@apache.org> on 2018/06/19 17:14:00 UTC

[jira] [Created] (CXF-7765) UrlTemplate.compareTemplates returns inconsistent results

Shon Vella created CXF-7765:
-------------------------------

             Summary: UrlTemplate.compareTemplates returns inconsistent results
                 Key: CXF-7765
                 URL: https://issues.apache.org/jira/browse/CXF-7765
             Project: CXF
          Issue Type: Bug
          Components: JAX-RS
    Affects Versions: 3.1.15
            Reporter: Shon Vella


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 if unpredictability of the prioritization of when selecting the appropriate JAX-RS method to call for a give request.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)