You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2013/04/08 19:59:15 UTC

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

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

Gary Gregory commented on CODEC-169:
------------------------------------

This is obviously broken in concept since you cannot tell an error result from an equal result.

I see these options:

- Document it better, leave the code as is
- Change the code to thrown an unchecked exception that wraps the EncoderException. Then you can tell error vs equal. I am not sure this is suitable for 1.x instead of 2.0.

In addition: Redo it in the context of generics in 2.0.
                
> 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