[
https://issues.apache.org/jira/browse/DIRAPI-328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16735429#comment-16735429
]
Emmanuel Lecharny commented on DIRAPI-328:
------------------------------------------
I have renamed the {{Value.getValue()}} method.
Regarding the {{Value.getString()}} method, it's mainly use when we know the
value is {{HR}}, or we check if it's HR}} beforehand. One typical case where we
use it on a binary attribute is for the {{UserPassword}} which is not HR, but
considered as a String (which is most certainly not a good idea).
Atm, considering the impact on the existent code, throwing a
{{LdapInvalidAttributeValueException}} when the value is not HR would be big. I
would favor a Javadoc update for the moment.
> Fix inconsistency in Attribute and Value
> ----------------------------------------
>
> Key: DIRAPI-328
> URL: https://issues.apache.org/jira/browse/DIRAPI-328
> Project: Directory Client API
> Issue Type: Improvement
> Reporter: Stefan Seelmann
> Assignee: Emmanuel Lecharny
> Priority: Major
> Fix For: 2.0.0.AM3
>
>
> Inconsistent method names:
> * Attribute: getString() and getBytes()
> * Value: getValue() and getBytes()
> * Proposal: Rename Value.getValue() to Value.getString()
> Inconsistent and wrong documented error handling:
> * Attribute: getString() and getBytes() check for isHumanReadable and throw
> LdapInvalidAttributeValueException
> * Value: getValue()/getString() tries to UTF-8 encode bytes if not human
> readable, which doesn't work always, and javadoc says "returns null"
> * Value: getBytes() doesn't check if is human readable
> * Proposal: Make Value behave like Attribute, i.e. throw
> LdapInvalidAttributeValueException
> Opinions?
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)