fix(docx): build a field's run through the IRunBody constructor - #730
Merged
Merged
Conversation
new XWPFRun(CTR, XWPFParagraph) is deprecated in POI and delegates to XWPFRun(CTR, IRunBody). The page field and page reference writers now call the latter directly, as the hyperlink writer already does. The written XML is unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
CodeQL flagged
DocxSemanticBackendon #729 for "Deprecated method or constructor invocation":new XWPFRun(CTR, XWPFParagraph). The page-reference writer from #729 calls it, and so does the zone page-field writer, which predates #729. POI deprecates this overload in favour ofXWPFRun(CTR, IRunBody), which it delegates to.What changed
appendPageFieldandwritePageReferencepass the paragraph asIRunBody, the same way the hyperlink writer already builds its runs. Both calls now go straight to the constructor POI keeps.Verification
./mvnw verify -pl :graph-compose-render-docx→ 299 tests green.clean verifyover core, render-pdf/docx/pptx, templates, testing, qa, coverage) → BUILD SUCCESS.Lane: shared-engine (render-docx). No behaviour or API change.