[
https://issues.apache.org/jira/browse/CXF-7765?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16521279#comment-16521279
]
Shon Vella commented on CXF-7765:
---------------------------------
[~deki] - Will try to find time to do that.
[[email protected]], I'm reasonably sure the lexical ordering of the
strings is uninteresting as this is being used to prioritize match patterns and
the longer the number of literal characters that match, the higher priority.
Lexical ordering becomes a last resort when all the more important factors have
compared equal and is handled by the string comparison of the pattern values at
the end.
> 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
> Priority: Major
>
> 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 give request.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)