On 05/26/2015 02:10 PM, [email protected] wrote:
> Author: semancik
> Date: Tue May 26 12:10:25 2015
> New Revision: 1681745
> 
> URL: http://svn.apache.org/r1681745
> Log:
> Check if we really need to specify newSuperior in moveAndRename(...)
> newSuperior is optional [RFC4511, section 4.9]. Some servers (e.g. OpenDJ 
> 2.6) require a special privilege if
> newSuperior is specified even if it is the same as the old one. Therefore 
> let's not specify it if we do not need it.
> This is better interoperability.
> 
> Modified:
>     
> directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
> 
> Modified: 
> directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
> URL: 
> http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java?rev=1681745&r1=1681744&r2=1681745&view=diff
> ==============================================================================
> --- 
> directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
>  (original)
> +++ 
> directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
>  Tue May 26 12:10:25 2015
> @@ -2625,7 +2625,18 @@ public class LdapNetworkConnection exten
>          ModifyDnRequest modDnRequest = new ModifyDnRequestImpl();
>          modDnRequest.setName( entryDn );
>          modDnRequest.setNewRdn( newDn.getRdn() );
> -        modDnRequest.setNewSuperior( newDn.getParent() );
> +        
> +        // Check if we really need to specify newSuperior.
> +        // newSuperior is optional [RFC4511, section 4.9]
> +        // Some servers (e.g. OpenDJ 2.6) require a special privilege if
> +        // newSuperior is specified even if it is the same as the old one. 
> Therefore let's not
> +        // specify it if we do not need it. This is better interoperability. 
> +        Dn newDnParent = entryDn.getParent();

I think this should be

    Dn newDnParent = newDn.getParent();

> +        if ( newDnParent != null && !newDnParent.equals( newDn.getParent() ) 
> )

And here:

    if ( newDnParent != null && !newDnParent.equals( entryDn.getParent() ) )

> +        {
> +            modDnRequest.setNewSuperior( newDnParent );
> +        }
> +        

Otherwise the old parent is used. See also test failures on Jenkins:
https://builds.apache.org/job/dir-apacheds-ubuntu-deploy/1718/

>          modDnRequest.setDeleteOldRdn( deleteOldRdn );
>  
>          ModifyDnResponse modifyDnResponse = modifyDn( modDnRequest );
> 
> 

Reply via email to