[ 
https://issues.apache.org/jira/browse/DIRAPI-123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13596900#comment-13596900
 ] 

Emmanuel Lecharny commented on DIRAPI-123:
------------------------------------------

Removing an attribute with no value will remove the attribute entirely. This is 
consistant with the RFC 4511, 4.6 :
"           delete: delete values listed from the modification attribute.
           If no values are listed, or if all current values of the
           attribute are listed, the entire attribute is removed.

"
                
> o.a.d.api.ldap.model.message.ModifyRequestImpl.remove() with 0 elements 
> should be a no-op
> -----------------------------------------------------------------------------------------
>
>                 Key: DIRAPI-123
>                 URL: https://issues.apache.org/jira/browse/DIRAPI-123
>             Project: Directory Client API
>          Issue Type: Bug
>    Affects Versions: 1.0.0-M15
>            Reporter: Rudi Wijaya
>
> Before call to ModifyRequestImpl.add() :
> {code}
> MessageType : MODIFY_REQUEST
> Message ID : -1
>     Modify Request
>         Object : 'uid=hendy,ou=users,dc=aksimata,dc=com'
> org.apache.directory.api.ldap.model.message.ModifyRequestImpl@5ee989e2
> {code}
> After calling ModifyRequestImpl.add() :
> {code}
> MessageType : MODIFY_REQUEST
> Message ID : -1
>     Modify Request
>         Object : 'uid=hendy,ou=users,dc=aksimata,dc=com'
>             Modification[0]
>                 Operation :  add
>                 Modification
> mail: [email protected]
> org.apache.directory.api.ldap.model.message.ModifyRequestImpl@57ba462
> {code}
> After calling ModifyRequestImpl.remove("mail", new String[] { }); :
> {code}
> MessageType : MODIFY_REQUEST
> Message ID : -1
>     Modify Request
>         Object : 'uid=hendy,ou=users,dc=aksimata,dc=com'
>             Modification[0]
>                 Operation :  add
>                 Modification
> mail: [email protected]
>             Modification[1]
>                 Operation :  delete
>                 Modification
> mail: (null)
> org.apache.directory.api.ldap.model.message.ModifyRequestImpl@152f7a24
> {code}
> The expected behavior should be : since it's removing a variable number of 
> attribute values, and the number of values is 0, hence it's a no-op.
> Also, any attempt to remove "null" should be an error: (haven't checked yet)
> {code}
> modifyRequest.remove("mail", new String[] { null });
> modifyRequest.remove("mail", new String[] { null, null });
> modifyRequest.remove("mail", null);
> modifyRequest.remove("mail", null, null);
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to