Project

Profile

Help

Bug #4386

setProperty and setParameter does not replace keys already in the map

Added by O'Neil Delpratt about 2 years ago. Updated about 2 years ago.

Status:
Resolved
Priority:
Normal
Category:
C++ API
Start date:
2019-11-15
Due date:
% Done:

0%

Estimated time:
Found in version:
1.2.1
Fixed in version:
Platforms:

Description

Reported in the forum post: https://saxonica.plan.io/boards/4/topics/7680

Across all the processors when we use the setProperty and setParameter methods if a key already exists in the properties or parameters map the value of the key is not updated with the new value.

A workaround would be to call clearProperties() and clearParameters() before updating new values. There is also a removeParameter method which can be used before the new parameter is updated/added.

History

#1 Updated by O'Neil Delpratt about 2 years ago

In the C++ API we use the map::insert method to add key, value pairs. However the the API documentation for the insert method states:

Because element keys in a map are unique, the insertion operation checks whether each inserted element has a key equivalent to the one of an element already in the container, and if so, the element is not inserted, returning an iterator to this existing element (if the function returns a value).

Therefore using the insert method will not work if the key exists already.

#2 Updated by O'Neil Delpratt about 2 years ago

  • Status changed from New to Resolved

Bug fixed and added C++ test cases.

Please register to edit this issue

Also available in: Atom PDF