Results 1 to 3 of 3

Thread: DirContextAdapter setAttributeValue doesn't work if value is reset

Hybrid View

  1. #1
    Luke Taylor is offline Senior Member Acegi Security System TeamSpring Team
    Join Date
    Aug 2004
    Location
    Glasgow, Scotland
    Posts
    3,449

    Default DirContextAdapter setAttributeValue doesn't work if value is reset

    Hi,

    I've noticed using DirContextAdapter in update mode that if you attempt to reset a value (which has previously been modified) to it's original value, then it will retain the previous value which was set. e.g. assuming I have an instance "ctx" which has an attribute "myattr" with values {a,b,c} initially:

    Code:
    ctx.setAttributeValues("myattr", new String[] {"a", "b"});
    ctx.setAttributeValues("myattr", new String[] {"a", "b", "c"});
    ctx.getModificationItems();
    will incorrectly result in a modification to remove the value "c" from the attribute.

    This seems to be because the comparison is only being made with "attrs". The value in "updatedAttrs" should probably be checked too to make sure it hasn't already been changed to a different value.

    I've attached a test case for the problem..

    cheers,

    Luke.
    Attached Files Attached Files

  2. #2
    Join Date
    Mar 2005
    Location
    Landskrona, Sweden
    Posts
    505

    Default

    You're right, that doesn't seem to be working as it should. Thanks.
    Mattias Arthursson
    Jayway AB (www.jayway.se)
    Spring-LDAP project member

  3. #3
    Join Date
    Jul 2005
    Location
    Helsingborg, Sweden
    Posts
    504

    Default

    This issue has now been fixed. There were actually three distinct cases that needed to be resolved:

    Code:
    [a,b,c] -> [a,b] -> [a,b,c]
    [a,b,c] -> [a,b,d] -> [a,b,c]
    a -> b -> a
    Ulrik Sandberg
    Jayway (www.jayway.com)
    Spring LDAP project member

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •