Skip to content

META-379: fix PersistentBag and PersistentSortedMap conversion#75

Open
yegres-teluer wants to merge 1 commit into
openmrs:masterfrom
yegres-teluer:META-379
Open

META-379: fix PersistentBag and PersistentSortedMap conversion#75
yegres-teluer wants to merge 1 commit into
openmrs:masterfrom
yegres-teluer:META-379

Conversation

@yegres-teluer
Copy link
Copy Markdown

@yegres-teluer yegres-teluer commented Dec 16, 2025

Hi team,

This is to fix the long-hanging bug META-379
aka https://openmrs.atlassian.net/browse/META-377
aka https://openmrs.atlassian.net/browse/META-380
aka https://openmrs.atlassian.net/browse/META-381
(not sure why we have all those clones in Jira, but the bug is valid)

The existing conversion logic was not handling PersistentBag, PersistentIdentifierBag, and PersistentSortedMap correctly.
The fix will convert all PersistentCollection implementations correctly.

Added unit tests to validate the solution.


if (source instanceof PersistentList) {
source = new ArrayList((Collection) source);
} else if (source instanceof PersistentMap) {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checking this before checking for PersistentSortedMap was wrong

public void marshal(Object source, HierarchicalStreamWriter writer,
MarshallingContext context, ConverterLookup converterLookup) {

if (source instanceof PersistentList) {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This missed PersistentBag and PersistentIdentifierBag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants