Skip to content

Report a clear error for an unparsable extensions.xml - #13947

Merged
gnodet merged 2 commits into
apache:maven-3.10.xfrom
arturobernalg:fix/mng-8369-extensions-xml-parse-error-3.10.x
Nov 12, 2026
Merged

gnodet merged 2 commits into
apache:maven-3.10.xfrom
arturobernalg:fix/mng-8369-extensions-xml-parse-error-3.10.x

Conversation

@arturobernalg

@arturobernalg arturobernalg commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

readCoreExtensionsDescriptor() let any failure from the XML parser escape as-is, so an empty or otherwise malformed .mvn/extensions.xml surfaced as a bare "input contained no data" EOFException with a full stack trace instead of a message naming the problem file.

Wrap the parse failure in an IOException that names the extensions file, keeping the original exception as the cause so -e still shows the full chain.

Fixes #10258

Also reproduces on maven-3.9.9/3.9.x via the equivalent code in maven-embedder's MavenCli (same unguarded parser.read() call, different file API). Happy to open a backport PR to maven-3.9.x if a maintainer wants it there too.

readCoreExtensionsDescriptor() let any failure from the XML parser
escape as-is, so an empty or otherwise malformed .mvn/extensions.xml
surfaced as a bare "input contained no data" EOFException with a full
stack trace instead of a message naming the problem file.

Wrap the parse failure in an IOException that names the extensions
file, keeping the original exception as the cause so -e still shows
the full chain.

Fixes apache#10258

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean, minimal fix that wraps opaque XML-parser exceptions in an IOException naming the offending file. The exception chain is correct (e.getMessage() + cause), the test covers the reported case, and widening the method visibility follows the existing pattern in this class.

One low-severity nit on the method signature (see inline).

The PR body mentions the equivalent code path in maven-3.9.x — a backport to maven-3.9.17 would be welcome if a maintainer agrees.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@gnodet gnodet added the bug Something isn't working label Nov 12, 2026
The catch block wraps every IOException and XmlPullParserException
into a new IOException, so XmlPullParserException can never escape
readCoreExtensionsDescriptor() - declaring it on the method signature
is misleading to callers.
@gnodet
gnodet merged commit 9e00cd4 into apache:maven-3.10.x Nov 12, 2026
16 checks passed
@gnodet gnodet added this to the 3.10.2 milestone Nov 12, 2026
gnodet added a commit to gnodet/maven that referenced this pull request Nov 12, 2026
Port of apache#13947 (maven-3.10.x) to the `maven-4.0.x` compat layer.

readCoreExtensionsDescriptor() let any failure from the XML parser escape
as-is, so an empty or otherwise malformed .mvn/extensions.xml surfaced as
a bare EOFException or XMLStreamException with a full stack trace instead
of a message naming the problem file.

Wrap the parse failure in an IOException that names the extensions file,
keeping the original exception as the cause so -e still shows the full chain.

Fixes apache#10258
gnodet added a commit to gnodet/maven that referenced this pull request Nov 12, 2026
Port of apache#13947 (maven-3.10.x) to the `master` compat layer.

readCoreExtensionsDescriptor() let any failure from the XML parser escape
as-is, so an empty or otherwise malformed .mvn/extensions.xml surfaced as
a bare EOFException or XMLStreamException with a full stack trace instead
of a message naming the problem file.

Wrap the parse failure in an IOException that names the extensions file,
keeping the original exception as the cause so -e still shows the full chain.

Fixes apache#10258
@gnodet gnodet changed the title [MNG-8369] Report a clear error for an unparsable extensions.xml Report a clear error for an unparsable extensions.xml Nov 12, 2026
gnodet added a commit that referenced this pull request Nov 12, 2026
Port of #13947 (maven-3.10.x) to the `maven-4.0.x` compat layer.

readCoreExtensionsDescriptor() let any failure from the XML parser escape
as-is, so an empty or otherwise malformed .mvn/extensions.xml surfaced as
a bare EOFException or XMLStreamException with a full stack trace instead
of a message naming the problem file.

Wrap the parse failure in an IOException that names the extensions file,
keeping the original exception as the cause so -e still shows the full chain.

Fixes #10258
gnodet added a commit that referenced this pull request Nov 12, 2026
* [MNG-8369] Report a clear error for an unparsable extensions.xml

Port of #13947 (maven-3.10.x) to the `master` compat layer.

readCoreExtensionsDescriptor() let any failure from the XML parser escape
as-is, so an empty or otherwise malformed .mvn/extensions.xml surfaced as
a bare EOFException or XMLStreamException with a full stack trace instead
of a message naming the problem file.

Wrap the parse failure in an IOException that names the extensions file,
keeping the original exception as the cause so -e still shows the full chain.

Fixes #10258

* Report a clear error for an unparsable extensions.xml

Port of #13947 (maven-3.10.x) to the `master` compat layer.

readCoreExtensionsDescriptor() let any failure from the XML parser escape
as-is, so an empty or otherwise malformed .mvn/extensions.xml surfaced as
a bare EOFException or XMLStreamException with a full stack trace instead
of a message naming the problem file.

Wrap the parse failure in an IOException that names the extensions file,
keeping the original exception as the cause so -e still shows the full chain.

Fixes #10258
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants