Skip to content

fix(docx): build a field's run through the IRunBody constructor - #730

Merged
DemchaAV merged 1 commit into
2.5-devfrom
fix/docx-run-constructor
Sep 23, 2026
Merged

DemchaAV merged 1 commit into
2.5-devfrom
fix/docx-run-constructor

Conversation

@DemchaAV

Copy link
Copy Markdown
Owner

Why

CodeQL flagged DocxSemanticBackend on #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 of XWPFRun(CTR, IRunBody), which it delegates to.

What changed

  • appendPageField and writePageReference pass the paragraph as IRunBody, the same way the hyperlink writer already builds its runs. Both calls now go straight to the constructor POI keeps.
  • The written XML is unchanged: the deprecated overload only forwards to the one now called.

Verification

  • ./mvnw verify -pl :graph-compose-render-docx → 299 tests green.
  • Full reactor gate (clean verify over core, render-pdf/docx/pptx, templates, testing, qa, coverage) → BUILD SUCCESS.
  • Examples after install: 93 green. The committed DOCX preview did not move.

Lane: shared-engine (render-docx). No behaviour or API change.

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.
@DemchaAV
DemchaAV merged commit a4726fc into 2.5-dev Sep 23, 2026
10 checks passed
@DemchaAV
DemchaAV deleted the fix/docx-run-constructor branch September 23, 2026 15:28
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