GeezerVison is showing github.com — [MNG-8174] Fix NPE when a property references itself in a plugin configuration (backport #12932) by elharo · Pull Request #12935 · apache/maven
Conversation
Backport of #12932 (merge commit 8638f335) to maven-4.0.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 asserting 1 model error and that the config attribute retains ${prop}.
Tested: full StringVisitorModelInterpolatorTest (19 tests) + StringSearchModelInterpolatorTest pass.
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.
…iguration
Backport of #12932 to maven-4.0.x.
|
different failure than on 3.x branches:
-------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.apache.maven.jline.FastTerminalReentrancyTest
[ERROR] Tests run: 4, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.611 s <<< FAILURE! -- in org.apache.maven.jline.FastTerminalReentrancyTest
[ERROR] org.apache.maven.jline.FastTerminalReentrancyTest.arbitraryTerminalMethodsFromTheBuilderDoNotDeadlock -- Time elapsed: 0.019 s <<< ERROR!
java.lang.RuntimeException: java.util.concurrent.ExecutionException: org.apache.maven.api.services.MavenException: java.lang.NullPointerException: Cannot invoke "org.jline.terminal.Terminal.getSize()" because "t" is null
at org.apache.maven.jline.FastTerminal.getTerminal(FastTerminal.java:120)
at org.apache.maven.jline.FastTerminalReentrancyTest.installAndAwait(FastTerminalReentrancyTest.java:150)
at org.apache.maven.jline.FastTerminalReentrancyTest.lambda$arbitraryTerminalMethodsFromTheBuilderDoNotDeadlock$8(FastTerminalReentrancyTest.java:96)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:840)
Suppressed: java.lang.RuntimeException: java.util.concurrent.ExecutionException: org.apache.maven.api.services.MavenException: java.lang.NullPointerException: Cannot invoke "org.jline.terminal.Terminal.getSize()" because "t" is null
at org.apache.maven.jline.FastTerminal.getTerminal(FastTerminal.java:120)
at org.apache.maven.jline.MessageUtils.doSystemUninstall(MessageUtils.java:99)
at org.apache.maven.jline.MessageUtils.systemUninstall(MessageUtils.java:85)
at org.apache.maven.jline.FastTerminalReentrancyTest.tearDown(FastTerminalReentrancyTest.java:66)
at java.base/java.lang.reflect.Method.invoke(Method.java:569)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: java.util.concurrent.ExecutionException: org.apache.maven.api.services.MavenException: java.lang.NullPointerException: Cannot invoke "org.jline.terminal.Terminal.getSize()" because "t" is null
at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073)
at org.apache.maven.jline.FastTerminal.getTerminal(FastTerminal.java:118)
... 6 more
Caused by: org.apache.maven.api.services.MavenException: java.lang.NullPointerException: Cannot invoke "org.jline.terminal.Terminal.getSize()" because "t" is null
at org.apache.maven.jline.FastTerminal.lambda$new$0(FastTerminal.java:101)
at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.NullPointerException: Cannot invoke "org.jline.terminal.Terminal.getSize()" because "t" is null
at org.apache.maven.jline.FastTerminalReentrancyTest.lambda$arbitraryTerminalMethodsFromTheBuilderDoNotDeadlock$6(FastTerminalReentrancyTest.java:100)
at org.apache.maven.jline.FastTerminalReentrancyTest.lambda$installAndAwait$12(FastTerminalReentrancyTest.java:143)
at org.apache.maven.jline.MessageUtils.lambda$systemInstall$0(MessageUtils.java:55)
at org.apache.maven.jline.FastTerminal.lambda$new$0(FastTerminal.java:97)
... 1 more
Caused by: java.util.concurrent.ExecutionException: org.apache.maven.api.services.MavenException: java.lang.NullPointerException: Cannot invoke "org.jline.terminal.Terminal.getSize()" because "t" is null
at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073)
at org.apache.maven.jline.FastTerminal.getTerminal(FastTerminal.java:118)
... 6 more
Caused by: [CIRCULAR REFERENCE: org.apache.maven.api.services.MavenException: java.lang.NullPointerException: Cannot invoke "org.jline.terminal.Terminal.getSize()" because "t" is null]
[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] FastTerminalReentrancyTest.lambda$arbitraryTerminalMethodsFromTheBuilderDoNotDeadlock$8:96->installAndAwait:150 » Runtime java.util.concurrent.ExecutionException: org.apache.maven.api.services.MavenException: java.lang.NullPointerException: Cannot invoke "org.jline.terminal.Terminal.getSize()" because "t" is null
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
different failure than on 3.x branches:
-------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.apache.maven.jline.FastTerminalReentrancyTest
[ERROR] Tests run: 4, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.611 s <<< FAILURE! -- in org.apache.maven.jline.FastTerminalReentrancyTest
[ERROR] org.apache.maven.jline.FastTerminalReentrancyTest.arbitraryTerminalMethodsFromTheBuilderDoNotDeadlock -- Time elapsed: 0.019 s <<< ERROR!
java.lang.RuntimeException: java.util.concurrent.ExecutionException: org.apache.maven.api.services.MavenException: java.lang.NullPointerException: Cannot invoke "org.jline.terminal.Terminal.getSize()" because "t" is null
at org.apache.maven.jline.FastTerminal.getTerminal(FastTerminal.java:120)
at org.apache.maven.jline.FastTerminalReentrancyTest.installAndAwait(FastTerminalReentrancyTest.java:150)
at org.apache.maven.jline.FastTerminalReentrancyTest.lambda$arbitraryTerminalMethodsFromTheBuilderDoNotDeadlock$8(FastTerminalReentrancyTest.java:96)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:840)
Suppressed: java.lang.RuntimeException: java.util.concurrent.ExecutionException: org.apache.maven.api.services.MavenException: java.lang.NullPointerException: Cannot invoke "org.jline.terminal.Terminal.getSize()" because "t" is null
at org.apache.maven.jline.FastTerminal.getTerminal(FastTerminal.java:120)
at org.apache.maven.jline.MessageUtils.doSystemUninstall(MessageUtils.java:99)
at org.apache.maven.jline.MessageUtils.systemUninstall(MessageUtils.java:85)
at org.apache.maven.jline.FastTerminalReentrancyTest.tearDown(FastTerminalReentrancyTest.java:66)
at java.base/java.lang.reflect.Method.invoke(Method.java:569)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: java.util.concurrent.ExecutionException: org.apache.maven.api.services.MavenException: java.lang.NullPointerException: Cannot invoke "org.jline.terminal.Terminal.getSize()" because "t" is null
at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073)
at org.apache.maven.jline.FastTerminal.getTerminal(FastTerminal.java:118)
... 6 more
Caused by: org.apache.maven.api.services.MavenException: java.lang.NullPointerException: Cannot invoke "org.jline.terminal.Terminal.getSize()" because "t" is null
at org.apache.maven.jline.FastTerminal.lambda$new$0(FastTerminal.java:101)
at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.NullPointerException: Cannot invoke "org.jline.terminal.Terminal.getSize()" because "t" is null
at org.apache.maven.jline.FastTerminalReentrancyTest.lambda$arbitraryTerminalMethodsFromTheBuilderDoNotDeadlock$6(FastTerminalReentrancyTest.java:100)
at org.apache.maven.jline.FastTerminalReentrancyTest.lambda$installAndAwait$12(FastTerminalReentrancyTest.java:143)
at org.apache.maven.jline.MessageUtils.lambda$systemInstall$0(MessageUtils.java:55)
at org.apache.maven.jline.FastTerminal.lambda$new$0(FastTerminal.java:97)
... 1 more
Caused by: java.util.concurrent.ExecutionException: org.apache.maven.api.services.MavenException: java.lang.NullPointerException: Cannot invoke "org.jline.terminal.Terminal.getSize()" because "t" is null
at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073)
at org.apache.maven.jline.FastTerminal.getTerminal(FastTerminal.java:118)
... 6 more
Caused by: [CIRCULAR REFERENCE: org.apache.maven.api.services.MavenException: java.lang.NullPointerException: Cannot invoke "org.jline.terminal.Terminal.getSize()" because "t" is null]
[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] FastTerminalReentrancyTest.lambda$arbitraryTerminalMethodsFromTheBuilderDoNotDeadlock$8:96->installAndAwait:150 » Runtime java.util.concurrent.ExecutionException: org.apache.maven.api.services.MavenException: java.lang.NullPointerException: Cannot invoke "org.jline.terminal.Terminal.getSize()" because "t" is null
Please rebase on latest 4.0.x, I fixed this issue.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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 backport of the merged master fix (#12932) to maven-4.0.x. The diff is functionally identical to the original — correct null guard added to DefaultLifecycles.calculateForkPhase() to prevent NPE when a property references itself in plugin configuration. No issues found.
📋 PR Metadata
| Aspect |
Current |
Suggested |
| Labels |
(none) |
bug |
| Milestone |
(none) |
4.0.0-rc-7 |
Sibling backports: #12936 → maven-3.10.x, #12937 → maven-3.9.x
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of Guillaume Nodet
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
@gnodet Please assign appropriate label to PR according to the type of change.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
gnodet
gnodet approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Labels
bug
Something isn't working
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|