Announcement Announcement Module
Collapse
No announcement yet.
DirContextAdapter setAttributeValue doesn't work if value is reset Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.

  • #2
    You're right, that doesn't seem to be working as it should. Thanks.

    Comment


    • #3
      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

      Comment

      Working...
      X