DN parser, LdapDN, Rdn, Atav issues
-----------------------------------

                 Key: DIRSHARED-40
                 URL: https://issues.apache.org/jira/browse/DIRSHARED-40
             Project: Directory Shared
          Issue Type: Bug
    Affects Versions: 0.9.15
            Reporter: Stefan Seelmann


In the last days I tried to fix DIRSHARED-39 and investigated some issues in 
the DN/Rdn/ATAV implementation. I just want to write them down, I think it 
makes sense to fix them after the schema branch is finished.

Class AttributeTypeAndValue:
- the first three constructors are not used by productive code, only by unit 
tests
- setType, setTypeNormalized, setValueNormalized are never used
- getNormalizedValue returns a name (<type>=<value>) instead of a value
- the meaning of upValue and normValue is not clear to me and is not 
consistent, see below
- upValue and normValue are of type Value<?>, however they contain escaped 
string values. IMO they should contain the real unescaped values because the 
escapes are only necessary for the DN string representation. For this case we 
have another field upName that contains <type>=<escaped value>

Class Rdn:
- three methods getValue, getUpValue, getNormValue; what does getValue() mean?
- getNormValue() for MV-RDN returns the calls ATAV.getNormalizedValue() which 
returns a name
- the meaning of upValue and normValue is not clear to me and not consistent, 
see below
- getUpValue and getNormValue always return strings, what if RDN value is 
binary?

Class RdnParser:
- this is still a hand-written parser. The hand-written code should be removed 
and the FastDnParser and ComplexDnParser should be used (like LdapDnParser)

General:
- getNormValue and getUpValue should return the Value<?> object instead of a 
String or byte[]
- getUpValue returns the escaped value, thus in the server and studio code we 
need to call Rdn.unescapeValue() to get the unescaped value
- the normalizing is quite complex, I was not able to understand how it works.

Example: for the DN "ou=A\ " (trailing escaped whitespace) we have the 
following issues:
After calling 
  LdapDN dn = new LdapDN("ou=A\\ ");
we have the following result:
  upValue is escaped: "A\ "
  nornValue is unescaped: "A "
  upName and normName are escaped: "ou=A\ "

After calling
  dn.normalize( oidOids );
we have the following result:
  upValue is still escaped: "A\ "
  normValue is "a" -> the space is gone!!!
  upName is "ou=A\ "
  normName is "2.5.4.11=a" -> the space is gone!!!



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

Reply via email to