[jira] [Commented] (CODEC-169) What should StringEncoderComparator do with non-Comparable encoded params?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (CODEC-169) What should StringEncoderComparator do with non-Comparable encoded params?

Dmitri Blinov (Jira)

    [ https://issues.apache.org/jira/browse/CODEC-169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13626019#comment-13626019 ]

Sebb commented on CODEC-169:
----------------------------

I agree the design is currently broken, but I don't think we can change that until 2.0.
Proper generics will eliminate the issue as only Strings would be allowed.

The question is: how to handle the CCE that can be generated for non-Comparable parameters.
- leave as is, but add Javadoc
- convert to zero, for consistency with non-String parameters and the existing implementations.
               

> What should StringEncoderComparator do with non-Comparable encoded params?
> --------------------------------------------------------------------------
>
>                 Key: CODEC-169
>                 URL: https://issues.apache.org/jira/browse/CODEC-169
>             Project: Commons Codec
>          Issue Type: Bug
>            Reporter: Sebb
>
> If the StringEncoderComparator is created with a StringEncoder that can generate a non-Comparable encoded version, then the compare() method will currently fail with ClassCastException.
> What should it do?
> Return 0 as for EncoderException?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira