Skip to content

Backport the UTF-8-without-BOM and ISO-8859-1 parsing fix to 3.x - #91

Merged
slachiewicz merged 1 commit into
3.xfrom
backport-encoding-fix-3.x
Aug 16, 2026
Merged

Backport the UTF-8-without-BOM and ISO-8859-1 parsing fix to 3.x#91
slachiewicz merged 1 commit into
3.xfrom
backport-encoding-fix-3.x

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

Backport of #1 (300a4e49) to the 3.x line, reported in #82.

The 3.x line is what Maven 3.9 ships, so a UTF-8 file with no BOM and an ISO-8859-1 declaration still fails there with UTF-8 BOM plus xml decl of ISO-8859-1 is incompatible. MXParser sniffed an encoding off the Reader and cross-checked it against the XML declaration; the sniffed value is the stream default, not the file's encoding, so the check fired on valid documents. Detection is left to XmlStreamReader, which reports a real mismatch as XmlStreamReaderException.

hst-lhs-007/008/009 are restored to driving the parser through setInput(InputStream, null), which is the path the fix changes — on 3.x they had been rewritten to hand-built readers that bypassed it.

ReaderFactory is kept where 3.x already used it, so the diff against master stays limited to the fix itself.

Verified: reverting XmlReader and MXParser to their pre-fix state fails 5 of these tests with the reported message; restoring them gives 214 passing.

This change was created with AI assistance.

* do not try to discover the encoding used when the input is given a Reader
* simplified test-encoding-ISO-8859-1.xml test file
* fixed tests exercising encoding checks. Unsupported tests were skipped

---------

Co-authored-by: Gabriel Belingueres <belingueres@gmail.com>
(cherry picked from commit 300a4e4)
@slachiewicz slachiewicz added bug Something isn't working java Pull requests that update Java code labels Aug 16, 2026
@slachiewicz
slachiewicz marked this pull request as ready for review August 16, 2026 19:49
@slachiewicz
slachiewicz merged commit 809231c into 3.x Aug 16, 2026
14 checks passed
@slachiewicz
slachiewicz deleted the backport-encoding-fix-3.x branch August 16, 2026 19:58
slachiewicz added a commit that referenced this pull request Aug 17, 2026
Release Drafter v7 resolves config-name against the ref that triggered the run,
not against the default branch. The file has only ever lived on master, so every
push to 3.x since the v6 -> v7 bump in #80 has failed with

  Repo load failed. Config file not found with error 404.
  (target: codehaus-plexus/.github:.github/release-drafter-3.x.yml)

and the 3.x draft has not been updated since June 2025 - it is missing #85, #89,
#91 and #93. Do not delete this copy as a duplicate of master's: both branches
need their own, and master's release-drafter-3.x.yml is now the dead one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working java Pull requests that update Java code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants