You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Emmanuel Lecharny (JIRA)" <ji...@apache.org> on 2007/05/12 18:17:15 UTC

[jira] Created: (DIRSERVER-928) Comparator may fail

Comparator may fail
-------------------

                 Key: DIRSERVER-928
                 URL: https://issues.apache.org/jira/browse/DIRSERVER-928
             Project: Directory ApacheDS
          Issue Type: Bug
          Components: ldap
    Affects Versions: 1.0.1, 1.5.0
            Reporter: Emmanuel Lecharny
            Priority: Critical


The org.apache.directory.shared.ldap.schema.ComparableComparator may fail if none of the two object implements the Comparable interface. As the last test is a comparison of their hashcode value, there is no guarantee that if they are equal, objects are equal.

We should throw an exception if the objects don't implement the Comparable interface. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DIRSERVER-928) ComparableComparator in shared yeild incorrect results when two objects compared are not Comparable

Posted by "Alex Karasulu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRSERVER-928?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alex Karasulu updated DIRSERVER-928:
------------------------------------

    Summary: ComparableComparator in shared yeild incorrect results when two objects compared are not Comparable  (was: Comparator may fail)

Clarifying the title of this issue a bit.

> ComparableComparator in shared yeild incorrect results when two objects compared are not Comparable
> ---------------------------------------------------------------------------------------------------
>
>                 Key: DIRSERVER-928
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-928
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: ldap
>    Affects Versions: 1.0.1, 1.5.0
>            Reporter: Emmanuel Lecharny
>            Assignee: Alex Karasulu
>            Priority: Critical
>             Fix For: 1.5.1, 1.0.3
>
>
> The org.apache.directory.shared.ldap.schema.ComparableComparator may fail if none of the two object implements the Comparable interface. As the last test is a comparison of their hashcode value, there is no guarantee that if they are equal, objects are equal.
> We should throw an exception if the objects don't implement the Comparable interface. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (DIRSERVER-928) ComparableComparator in shared yeild incorrect results when two objects compared are not Comparable

Posted by "Alex Karasulu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRSERVER-928?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alex Karasulu closed DIRSERVER-928.
-----------------------------------

    Resolution: Fixed

I simply added an IllegalStateException instead of returning the difference between the hashCodes of the two objects in the comparator.  The choice for the exception comes from the fact that if you do use this comparator and one of the objects is not Comparable then you used it wrong and that's an invalid state for the software which was not intended.  The following commits were made for this fix:

For shared trunk used in ADS 1.5:

   http://svn.apache.org/viewvc?view=rev&revision=567175 

For shared 0.9.5 branch used in ADS 1.0:

   http://svn.apache.org/viewvc?view=rev&rev=567176

> ComparableComparator in shared yeild incorrect results when two objects compared are not Comparable
> ---------------------------------------------------------------------------------------------------
>
>                 Key: DIRSERVER-928
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-928
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: ldap
>    Affects Versions: 1.0.1, 1.5.0
>            Reporter: Emmanuel Lecharny
>            Assignee: Alex Karasulu
>            Priority: Critical
>             Fix For: 1.5.1, 1.0.3
>
>
> The org.apache.directory.shared.ldap.schema.ComparableComparator may fail if none of the two object implements the Comparable interface. As the last test is a comparison of their hashcode value, there is no guarantee that if they are equal, objects are equal.
> We should throw an exception if the objects don't implement the Comparable interface. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DIRSERVER-928) Comparator may fail

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRSERVER-928?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny updated DIRSERVER-928:
----------------------------------------

    Fix Version/s: 1.0.3
                   1.5.1

Let's fix this issue

> Comparator may fail
> -------------------
>
>                 Key: DIRSERVER-928
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-928
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: ldap
>    Affects Versions: 1.0.1, 1.5.0
>            Reporter: Emmanuel Lecharny
>            Priority: Critical
>             Fix For: 1.5.1, 1.0.3
>
>
> The org.apache.directory.shared.ldap.schema.ComparableComparator may fail if none of the two object implements the Comparable interface. As the last test is a comparison of their hashcode value, there is no guarantee that if they are equal, objects are equal.
> We should throw an exception if the objects don't implement the Comparable interface. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (DIRSERVER-928) Comparator may fail

Posted by "Alex Karasulu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRSERVER-928?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alex Karasulu reassigned DIRSERVER-928:
---------------------------------------

    Assignee: Alex Karasulu

> Comparator may fail
> -------------------
>
>                 Key: DIRSERVER-928
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-928
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: ldap
>    Affects Versions: 1.0.1, 1.5.0
>            Reporter: Emmanuel Lecharny
>            Assignee: Alex Karasulu
>            Priority: Critical
>             Fix For: 1.5.1, 1.0.3
>
>
> The org.apache.directory.shared.ldap.schema.ComparableComparator may fail if none of the two object implements the Comparable interface. As the last test is a comparison of their hashcode value, there is no guarantee that if they are equal, objects are equal.
> We should throw an exception if the objects don't implement the Comparable interface. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.