On 9/27/10 5:05 AM, Kiran Ayyagari wrote:
On Mon, Sep 27, 2010 at 3:30 AM, Emmanuel Lécharny<[email protected]> wrote:
On 9/26/10 11:30 PM, Stefan Seelmann wrote:
Hi Emmanuel,
On Sun, Sep 26, 2010 at 8:07 PM, Emmanuel Lecharny<[email protected]>
wrote:
Hi guys,
while investigating the NPE Stefan pointed out today, I found that the
DN,
RDN and AVA are not completely immutable.
AVA has two methods that can modify it :
getNormValue(),
getUpValue()
Fixed.
RDN has many methods modifying it contents :
clear(),
This should be removed completele.
Not necessarily. I will make it package protected, as it's used by the
RdnParser. In other words, the user won't be able to use it.
getAtav(),
getAttributeTypeAndValue( String type ),
getNormValue(),
getUpValue(),
getValue( String type ),
iterator(),
normalize( ... ) (all the methods),
readExternal( ObjectInput in )
There are also two addAttributeTypeAndValue() and a setUpName() method.
The addAttributeTypeAndValue should renamed to addAVA() IMO.
DN has some too :
DN( RDN )
add( RDN )
addAll( int posn, DN )
all these methods produce a new DN, so the original instance remains same
The problem is that the inner RDN are copied from the original RDN/DN,
so unless the RDN is immutable, we can modify the DN. The same for
addAll : rdns can potentially be modified in some ways. (to be double
checked)
addAllNormalized()
this is only used in the ServerContext.buildTarget() method, we can
remove it, but again
this produces a new DN
getRdn()
getRdn( int pos )
fixing RDN mutability issues will completely fix any issues with DN
mutability cause rest all modify
methods present in DN class will always return a new DN
Most certainly.
normalize(...)
Isn't that a paradox? The DN/RDN/AVA should be immutable. but we need
to modify them later in order to normalize them. IMO the only solution
is to have a constructor (or factory method) with a SchemaManager or
OID-Map parameter that normalizes the DN at construction time.
Yes. I think that the normalize() methods are still there because we
injected the schemaManager later in the design. We could get rid of it now,
maybe.
I think not, calling normalize() won't change the structure of DN but
adds another presentation
to the user provided form which server understands, it is harmless to
have this in DN and also
helps us in normalizing an already created DN when schema manager is available
To be double checked.
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com