[ 
https://issues.apache.org/jira/browse/DIRSHARED-40?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Seelmann updated DIRSHARED-40:
-------------------------------------

    Description: 
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  (TODO)
- setType, setTypeNormalized, setValueNormalized are never used  (TODO)
- getNormalizedValue returns a name (<type>=<value>) instead of a value  (fixed)
- the meaning of upValue and normValue is not clear to me and is not 
consistent, see below  (fixed)
- 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>  (fixed)

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

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

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

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\ "  (fixed, now it is "A ")
  nornValue is unescaped: "A "  (doesn't make sense to check this before 
normalization)
  upName and normName are escaped: "ou=A\ " (ok)

After calling
  dn.normalize( oidOids );
we have the following result:
  upValue is still escaped: "A\ " (fixed, now it is "A ")
  normValue is "a" -> the space is gone!!! (this is ok, the space is removed by 
the normalizer because it is not relevant for cn's syntax/matching)
  upName is "ou=A\ " (ok)
  normName is "2.5.4.11=a" -> the space is gone!!! (this is ok, the space is 
removed by the normalizer because it is not relevant for cn's syntax/matching)



  was:
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!!!




I added a comment about the current state to each item. The remaining tasks are:
- Should we remove unused constructors and methods?
- Should Rdn.get{Up|Norm}Value() return anValue<?> object? 
AVA.get{Up|Norm}Value() returns a Value<?> object.


> 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
>             Fix For: 1.0.0-RC1
>
>
> 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  (TODO)
> - setType, setTypeNormalized, setValueNormalized are never used  (TODO)
> - getNormalizedValue returns a name (<type>=<value>) instead of a value  
> (fixed)
> - the meaning of upValue and normValue is not clear to me and is not 
> consistent, see below  (fixed)
> - 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>  (fixed)
> Class Rdn:
> - three methods getValue, getUpValue, getNormValue; what does getValue() 
> mean?  (fixed)
> - getNormValue() for MV-RDN returns the calls ATAV.getNormalizedValue() which 
> returns a name  (fixed)
> - the meaning of upValue and normValue is not clear to me and not consistent, 
> see below  (fixed)
> - getUpValue and getNormValue always return strings, what if RDN value is 
> binary?  (TODO)
> 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)  (fixed)
> General:
> - getNormValue and getUpValue should return the Value<?> object instead of a 
> String or byte[]  (TODO)
> - getUpValue returns the escaped value, thus in the server and studio code we 
> need to call Rdn.unescapeValue() to get the unescaped value  (fixed)
> - the normalizing is quite complex, I was not able to understand how it 
> works. (fixed)
> 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\ "  (fixed, now it is "A ")
>   nornValue is unescaped: "A "  (doesn't make sense to check this before 
> normalization)
>   upName and normName are escaped: "ou=A\ " (ok)
> After calling
>   dn.normalize( oidOids );
> we have the following result:
>   upValue is still escaped: "A\ " (fixed, now it is "A ")
>   normValue is "a" -> the space is gone!!! (this is ok, the space is removed 
> by the normalizer because it is not relevant for cn's syntax/matching)
>   upName is "ou=A\ " (ok)
>   normName is "2.5.4.11=a" -> the space is gone!!! (this is ok, the space is 
> removed by the normalizer because it is not relevant for cn's syntax/matching)

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