Author: akarasulu Date: Fri Nov 26 18:21:34 2004 New Revision: 106679 URL: http://svn.apache.org/viewcvs?view=rev&rev=106679 Log: Fixed bug where rdn attribute values were being duplicated. Fixed now.
Modified: incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/jndi/EveDirContext.java Modified: incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/jndi/EveDirContext.java Url: http://svn.apache.org/viewcvs/incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/jndi/EveDirContext.java?view=diff&rev=106679&p1=incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/jndi/EveDirContext.java&r1=106678&p2=incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/jndi/EveDirContext.java&r2=106679 ============================================================================== --- incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/jndi/EveDirContext.java (original) +++ incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/jndi/EveDirContext.java Fri Nov 26 18:21:34 2004 @@ -279,7 +279,7 @@ { return ( DirContext ) super.createSubcontext( name ); } - + // @todo again note that we presume single attribute name components LdapName target = buildTarget( name ); String rdn = name.get( name.size() - 1 ); @@ -288,15 +288,20 @@ // Clone the attributes and add the Rdn attributes Attributes attributes = ( Attributes ) attrs.clone(); - attributes.put( rdnAttribute, rdnValue ); - - // Add the new context to the server which as a side effect adds + if ( attributes.get( rdnAttribute ) == null || + attributes.get( rdnAttribute ).size() == 0 || + ( ! attributes.get( rdnAttribute ).contains( rdnValue ) ) ) + { + attributes.put( rdnAttribute, rdnValue ); + } + + // Add the new context to the server which as a side effect adds getNexusProxy().add( target.toString(), target, attributes ); // Initialize the new context EveLdapContext ctx = new EveLdapContext( getPrincipal(), getNexusProxy(), getEnvironment(), target ); - + Control [] controls = ( ( EveLdapContext ) this ).getRequestControls(); if ( controls != null ) { @@ -306,7 +311,7 @@ { controls = new Control[0]; } - + ctx.setRequestControls( controls ); return ctx; }
