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 — [MNG-8174] Fix NPE when a property references itself in a plugin configuration (backport #12932) by elharo · Pull Request #12936 · apache/maven

Conversation

@elharo

@elharo elharo commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Backport of #12932 (merge commit 8638f335) to maven-3.10.x, fixing MNG-8174.

A self-referencing property used in a plugin configuration attribute caused an NPE during interpolation because interpolate() could return null while recursing, and the guard if (org != val) would still call setValue/setAttribute with null.

This backport:

  • Adds && val != null to both visit(Xpp3Dom) setters in StringVisitorModelInterpolator.
  • Adds regression test testRecursiveExpressionCycleInPluginConfiguration (asserts 2 model errors on 3.x, since the cycle is reported twice by the older plexus-interpolation) plus a new StringVisitorModelInterpolatorTest so the fix is actually exercised on 3.x.

Tested: focused new test + full StringSearchModelInterpolatorTest (33 tests) pass. Note: StringVisitorModelInterpolatorTest has 2 pre-existing, unrelated failures (testBasedir/testBaseUri) when projectDir is null, present even without this change.

Closes https://issues.apache.org/jira/browse/MNG-8174

Sorry, something went wrong.

Uh oh!

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

All reactions
@elharo

elharo commented Aug 30, 2026

Copy link
Copy Markdown
Contributor Author

same failure as on otther branch


[ERROR] Failures: 
[ERROR]   StringVisitorModelInterpolatorTest>AbstractModelInterpolatorTest.testBaseUri:337 expected: <myBaseUri/temp-repo> but was: <${project.baseUri}/temp-repo>
[ERROR]   StringVisitorModelInterpolatorTest>AbstractModelInterpolatorTest.testBasedir:315 expected: <file://localhost/myBasedir/temp-repo> but was: <file://localhost/${basedir}/temp-repo>
[INFO] 

All reactions

Sorry, something went wrong.

Uh oh!

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

@gnodet gnodet mentioned this pull request Sep 2, 2026
[MNG-8174] Fix NPE when a property references itself in a plugin configuration (backport #12932) #12935
Merged
@cstamas

cstamas commented Sep 21, 2026

Copy link
Copy Markdown
Member

Any further work planned on this PR?

All reactions

Sorry, something went wrong.

Uh oh!

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

gnodet-bot
gnodet-bot previously requested changes Sep 21, 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.

The production fix is correct — guarding dom.setValue() and dom.setAttribute() against null mirrors the existing guard in visit(Properties) and closes the NPE. No issues there.

However, the new StringVisitorModelInterpolatorTest class introduces two test failures that block this PR.

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
Comment thread ...r/src/test/java/org/apache/maven/model/interpolation/StringVisitorModelInterpolatorTest.java Resolved

Uh oh!

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

Comment thread ...uilder/src/test/java/org/apache/maven/model/interpolation/AbstractModelInterpolatorTest.java Resolved

Uh oh!

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

@elharo
elharo marked this pull request as draft September 21, 2026 11:28
@gnodet
gnodet force-pushed the MNG-8174-interpolator-npe-self-referencing-property-3.10.x branch from 8860841 to ce257ba Compare September 21, 2026 11:29
@gnodet

gnodet commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Fixed two issues that caused CI failures:

1. Unit test failures (both testBasedir and testBaseUri): StringVisitorModelInterpolatorTest was missing a @BeforeEach setUp() that calls super.setUp(). The base class AbstractModelInterpolatorTest.setUp() initializes the context Properties (basedir, project.baseUri) used by those tests. StringSearchModelInterpolatorTest does this correctly; the new class was missing it.

2. Integration test failures (MavenITmng4590, MavenITmng4379, MavenITmng3586, MavenIT0085): The backport accidentally brought in the master (4.x) versions of several files, removing the restricted-interpolation feature added in 3.10.0-rc-2:

  • AbstractStringBasedModelInterpolator.java — FULL_EXTERNAL_INTERPOLATION_PROPERTY, restrictExternalModelInterpolation(), restrictToSafeExpressions(), isSafeExternalExpression() were all removed
  • DefaultModelBuilder.java — sandboxed ProfileActivationContext for external models was removed
  • ProfileActivationContext.java, PropertyProfileActivator.java, DefaultModelValidator.java — associated code removed

The ITs check that without -Dmaven.model.dependencyInterpolation.full=true the build fails on system-path expressions — this was the correct 3.10.x behavior. By removing the restriction, those builds were succeeding when they shouldn't.

Fixed by restoring the 3.10.x versions of those files. The only functional change now is the intended NPE fix in StringVisitorModelInterpolator.visit(Xpp3Dom) (&& val != null) plus the new test class and test method.

Hermes Agent (Claude Sonnet 4.6) on behalf of Guillaume Nodet

All reactions

Sorry, something went wrong.

Uh oh!

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

@elharo @gnodet
[MNG-8174] Fix NPE when a property references itself in a plugin conf…
1edebe6
…iguration

Backport of #12932 to maven-3.10.x.
@gnodet
gnodet force-pushed the MNG-8174-interpolator-npe-self-referencing-property-3.10.x branch from ce257ba to 1edebe6 Compare September 21, 2026 12:12
@gnodet
gnodet requested a review from gnodet-bot September 21, 2026 13:11
@gnodet
gnodet marked this pull request as ready for review September 21, 2026 13:23
@cstamas cstamas added the bug Something isn't working label Sep 21, 2026
@cstamas cstamas added this to the 3.10.0 milestone Sep 21, 2026
gnodet
gnodet approved these changes Sep 21, 2026
View reviewed changes
@elharo
elharo dismissed gnodet-bot’s stale review September 21, 2026 19:30

I don't think we've agreed to let bots approve or disapprove code.

@cstamas
cstamas merged commit 2c24ba7 into maven-3.10.x Sep 22, 2026
15 checks passed

Uh oh!

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

@cstamas
cstamas deleted the MNG-8174-interpolator-npe-self-referencing-property-3.10.x branch September 22, 2026 11:12
@github-actions github-actions Bot assigned cstamas Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gnodet gnodet gnodet approved these changes
@gnodet-bot gnodet-bot Awaiting requested review from gnodet-bot

Uh oh!

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

Assignees

@cstamas cstamas

Labels

bug Something isn't working

Projects

None yet

Milestone

3.10.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

4 participants

@elharo @cstamas @gnodet @gnodet-bot
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.