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

Pavel Zlámal commented on DIRAPI-320:
-------------------------------------

First, thank you for the updated documentation.

You are right, that schema retrieved from openLDAP is missing a lot of 
attributes/syntaxes. They can be retrieved from {{cn=schema,cn=config}}, but it 
usually have protected access, so on clean install only root user can locally 
read schema entries and then they are stored in attributes with "olc" prefix, 
like "olcAttributeTypes".

I can dump such schema and manually remove olc prefix, but there is no suitable 
schema loader. They either expect LDIF in your schema format (containing "m-" 
prefixed attributes) or take connection and read entry by themselves. It would 
be nice to have constructor for {{DefaultSchemaLoader}}, where I can manually 
pass {{Entry}} containing necessary schema elements, since I can parse it from 
file using your library manually.

Back to the {{LdapSyntax}}. I believe, such fake object can be created, but how 
about registering it in registries, and what about X-NOT-HUMAN-READABLE flags? 
I don't see big picture, so it will be up to your decision.

 

> 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)

Reply via email to