Skip to content
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

Xpp3DomUtils#mergeIntoXpp3Dom() must not override the dominant value in case it is blank #212

Closed
kwin opened this issue Sep 11, 2022 · 1 comment

Comments

@kwin
Copy link
Contributor

kwin commented Sep 11, 2022

Despite the javadoc saying that

if the dominant root node's value is empty, set it to the recessive root node's value

which is clearly not true for blank values (i.e. length() > 0), still the dominant root node's value is overwritten by the recessive one in case it is blank(!) due to the trim logic in

return ( str == null || str.trim().length() == 0 );
.

As the Xpp3DomBuilder trims by default it seems like a bug to me that merging two Xpp3Dom s (usually created by Xpp3DomBuilder) should trim again before merging as this would only make a difference in case someone set xml:space="preserve" in the dominant Xpp3Dom which should IMHO take precedence.

@kwin
Copy link
Contributor Author

kwin commented Sep 11, 2022

I added a failing test case and fix in #213.

kwin added a commit to kwin/plexus-utils that referenced this issue Sep 11, 2022
@kwin kwin changed the title Xpp3DomUtils.mergeIntoXpp3Dom overrides the dominantValue in case it is blank Xpp3DomUtils.mergeIntoXpp3Dom overrides the dominant value in case it is blank Sep 12, 2022
@kwin kwin changed the title Xpp3DomUtils.mergeIntoXpp3Dom overrides the dominant value in case it is blank Xpp3DomUtils.mergeIntoXpp3Dom must not override the dominant value in case it is blank Sep 12, 2022
@michael-o michael-o changed the title Xpp3DomUtils.mergeIntoXpp3Dom must not override the dominant value in case it is blank Xpp3DomUtils#mergeIntoXpp3Dom() must not override the dominant value in case it is blank Oct 10, 2022
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

No branches or pull requests

1 participant