GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix NPE on a recursive property reference in a list field by renechoi · Pull Request #13099 · apache/maven

Conversation

@renechoi

@renechoi renechoi commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

On a recursive reference DefaultModelInterpolator records an ERROR and returns null. The transformer writes it into List<String> fields such as build/filters (its Properties branch already guards), and the immutable constructor calls List.copyOf, so the build dies with a bare NPE that hides the collected error:

java.lang.NullPointerException
 at java.util.List.copyOf(List.java:1193)
 at o.a.m.model.v4.MavenTransformer.transformBuild(:514)
 at o.a.m.impl.model.DefaultModelInterpolator.interpolateModel(:111)

Returning the original text fixes it at the source instead of in the generated template, and matches DecryptingSettingsTransformer and MNG-8174 (#12932), which covered Maven 3 only.

The new test fails on master with that NPE. Full mvn test: 3136 tests, 0 failures. Can open a maven-4.0.x backport.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@renechoi
Fix NPE on a recursive property reference in a list field
7ba0c50
DefaultModelInterpolator records an ERROR and returns null when the
interpolator throws on a recursive variable reference. The generated
transformer stores that null in List<String> model fields such as
build/filters, whose Properties sibling branch already guards against
it, and the immutable model constructor then copies the list with
List.copyOf. The build fails with a bare NullPointerException instead
of the "recursive variable reference" error that was just collected.

Return the original text instead, which is what the Properties branch
and StringVisitorModelInterpolator (MNG-8174) already do. The returned
instance is identical, so the transformer's newVal != oldVal check
stays false and unaffected models are still returned unchanged.
gnodet-bot
gnodet-bot approved these changes Sep 11, 2026
View reviewed changes

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Clean, minimal fix. Returning the original text on an InterpolatorException instead of null is the correct approach — the error is already collected in the problem collector, and the build will fail with a clear "recursive variable reference" message. Returning null caused a secondary NullPointerException in List.copyOf() that masked the real error.

Consistent with DecryptingSettingsTransformer and the Maven 3 fix (MNG-8174 / #12932).

Test covers the exact failure path: recursive properties in a List<String> model field (build/filters).

📋 PR Metadata

Aspect Current Suggested
Category (unlabeled) bug
Labels (none) + bug
Milestone (none) 4.1.0

🔀 Backport Status

⚠️ This bug fix targets master but no backport PRs were found for:

  • maven-4.0.x — no backport PR found (author mentions willingness to open one)

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gnodet gnodet added backport-to-4.0.x bug Something isn't working labels Sep 14, 2026
@gnodet gnodet added this to the 4.1.0 milestone Sep 15, 2026
@gnodet
gnodet merged commit 0aaa578 into apache:master Sep 15, 2026
20 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@gnodet gnodet mentioned this pull request Sep 15, 2026
Fix NPE on a recursive property reference in a list field (backport #13099 to 4.0.x) #13145
Merged
@github-actions github-actions Bot assigned gnodet Sep 15, 2026
@gnodet gnodet removed the backport-to-4.0.x label Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@gnodet-bot gnodet-bot gnodet-bot approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@gnodet gnodet

Labels

bug Something isn't working

Projects

None yet

Milestone

4.2.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@renechoi @gnodet-bot @gnodet
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.