Skip to content

[backport 3.9.x] Fix #12600: handle missing project index in forked executions - #12918

Open
gnodet wants to merge 1 commit into
maven-3.9.xfrom
backport/12600-to-3.9.x
Open

[backport 3.9.x] Fix #12600: handle missing project index in forked executions#12918
gnodet wants to merge 1 commit into
maven-3.9.xfrom
backport/12600-to-3.9.x

Conversation

@gnodet

@gnodet gnodet commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Backport of Handle missing project index in forked executions #12911 (merged to master) to maven-3.9.x
  • Guards against NullPointerException from auto-unboxing when ProjectIndex.getIndices().get() returns null for a project not in the reactor
  • Throws descriptive LifecycleExecutionException instead
  • Test adapted for 3.9.x (Java 8 APIs, @Requirement field injection)

* fix: handle missing forked project index

Signed-off-by: ulofiai <309826581+ulofiai@users.noreply.github.com>

* Add test for forked execution project index null guard

Test originally written for PR #12907 (our parallel fix for #12600).
Contributed here since this PR has the better exception constructor
(includes MojoExecution and MavenProject context).

See: #12907

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Signed-off-by: ulofiai <309826581+ulofiai@users.noreply.github.com>
Co-authored-by: ulofiai <309826581+ulofiai@users.noreply.github.com>
Co-authored-by: Guillaume Nodet <gnodet@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet gnodet added bug Something isn't working backport labels Aug 29, 2026

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

✅ Looks Good

Faithful backport of the NPE fix from master (#12911) to maven-3.9.x. CI is fully green across all platforms and Java versions.

The production code fix is identical to master — int to Integer, null check, descriptive LifecycleExecutionException. The only difference is the file path (maven-core/ vs impl/maven-core/), correct for the 3.9.x directory layout.

The test adaptations for 3.9.x are all well done:

  • Collections.singletonList()/Collections.emptyList() instead of List.of() for Java 8 compatibility
  • Reflection-based field injection for @Requirement instead of @InjectMocks
  • 3-arg executeForkedExecutions(mojoExecution, session, projectIndex) matching the 3.9.x method signature

📋 PR Metadata

Aspect Current Suggested
Milestone (none) 3.9.17

🔀 Backport Status

  • maven-3.9.x — this PR
  • maven-4.0.x#12917 (CI pending)
  • ⚠️ maven-3.10.x — no backport PR found (vulnerable code at line 434)

🤖 This review was generated by ForgeBot. Feedback? File an issue on the ForgeBot repo.

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

Labels

backport bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants