Skip to content

Maintain consistent element order in exports #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rogin
Copy link
Contributor

@rogin rogin commented Apr 19, 2025

Fixes an old and common complaint. Previous test results here. I've only verified that it built successfully using Java 8.

Testing points:

  • elements export in a consistent order
  • diffs (as with git, or diff) are improved with consistent order
  • imports with the new order import cleanly
  • legacy imports without ordered elements still import cleanly

jonbartels
jonbartels previously approved these changes Apr 20, 2025
Signed-off-by: Richard Ogin <rogin@users.noreply.github.com>
gibson9583
gibson9583 previously approved these changes Jun 16, 2025
kpalang
kpalang previously approved these changes Jun 16, 2025
@@ -9,11 +9,11 @@

package com.mirth.connect.donkey.model.message;

import java.util.HashMap;
import java.util.TreeMap;
Copy link
Member

Choose a reason for hiding this comment

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

Since a TreeMap is sorted and a HashMap is not, I'm guessing there could be considerable changes compared to a prior export the first time an export is done with the new code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct, then subsequent exports will benefit.

Copy link
Member

@tonygermano tonygermano Jun 20, 2025

Choose a reason for hiding this comment

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

Is there a purpose for having MapContent as part of this PR? I think it only shows up in a message export, and not part of the server configuration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll revert it and verify.

@rogin rogin dismissed stale reviews from kpalang, gibson9583, and jonbartels via 7162f41 June 18, 2025 20:13
@tonygermano
Copy link
Member

tonygermano commented Jun 20, 2025

Can you describe your testing? I'm sure this does work when creating and exporting new code templates and libraries. Do we know for certain that when xstream creates the objects from xml that it isn't recreating them as HashSets?

@jonbartels jonbartels added enhancement New feature or request help wanted Extra attention is needed labels Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants