Skip to content

split embedded ]]> across CDATA sections when serializing - #903

Open
Sahana2524 wants to merge 1 commit into
FasterXML:3.xfrom
Sahana2524:cdata-end-marker-split
Open

split embedded ]]> across CDATA sections when serializing#903
Sahana2524 wants to merge 1 commit into
FasterXML:3.xfrom
Sahana2524:cdata-end-marker-split

Conversation

@Sahana2524

Copy link
Copy Markdown
Contributor

CDATA values containing ]]> fail to serialize

A @JacksonXmlCData string is handed straight to writeCData, and since ]]> closes a CDATA section the underlying Woodstox writer rejects it, so any value carrying that sequence cannot be written at all and the round-trip guarantee breaks. The safe form is to split at each ]]> (keep the ]] in one section, push the > into the next); a coalescing reader, which is the default here, reads the pieces back as the original text. I put the split in a shared StaxUtil.writeCData helper so the plain and pretty-printing paths behave the same.

@Sahana2524
Sahana2524 force-pushed the cdata-end-marker-split branch from 7e8f479 to 1a6557d Compare August 24, 2026 10:44
@github-actions

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 74.01% 📉 -0.180%
Branches branches 68.74% 📉 -0.230%

Coverage data generated from JaCoCo test results

1 similar comment
@github-actions

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 74.01% 📉 -0.180%
Branches branches 68.74% 📉 -0.230%

Coverage data generated from JaCoCo test results

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.

1 participant