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 2018/09/13 03:14:00 UTC

[jira] [Comment Edited] (DIRAPI-320) ClassCastException on Objects.equals(Value,Value) for userPassword attribute

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

Emmanuel Lecharny edited comment on DIRAPI-320 at 9/13/18 3:13 AM:
-------------------------------------------------------------------

For instance, a loaded {{OpenLDAP}} schema will have this {{MatchingRule}} :

{noformat}
( 2.5.13.10 NAME 'numericStringSubstringsMatch' SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
{noformat}

but the associated syntax ({{1.3.6.1.4.1.1466.115.121.1.58}}) is not present in the schema...


was (Author: elecharny):
For instance, a loaded {{OpenLDAP}} schema will have this {{MatchingRule}} :

{npformat}
( 2.5.13.10 NAME 'numericStringSubstringsMatch' SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
{noformat}

but the associated syntax ({{1.3.6.1.4.1.1466.115.121.1.58}}) is not present in the schema...

> ClassCastException on Objects.equals(Value,Value) for userPassword attribute
> ----------------------------------------------------------------------------
>
>                 Key: DIRAPI-320
>                 URL: https://issues.apache.org/jira/browse/DIRAPI-320
>             Project: Directory Client API
>          Issue Type: Bug
>    Affects Versions: 2.0.0.AM2
>            Reporter: Pavel Zlámal
>            Priority: Minor
>
> When I use _JarLdifSchemaLoader_ it seems to load _userPassword_ attribute type with different Comparator than when I load it from LDAP connection (openLDAP in my case).
> Then If I call:
> {code:java}
> Objects.equals(val, attribute.get())
> {code}
> to check if value passed to my method is the first in the attribute, I get _ClassCastException_, since it tries to pass _String_ (normalized value) to the _ByteArrayComparator._
> When I use Schema only loaded from connection, then it works, since it uses _ComparableComparator._
> {code:java}
> java.lang.ClassCastException: java.lang.String cannot be cast to [B
>     at org.apache.directory.api.ldap.model.schema.comparators.ByteArrayComparator.compare(ByteArrayComparator.java:32)
>     at org.apache.directory.api.ldap.model.entry.Value.equals(Value.java:1389)
>     at java.util.Objects.equals(Objects.java:59)
> {code}
> So there is probably bug in schema ldif included in JAR or in equals() implementation of Value.



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