Skip to content

[maven-4.0.x] MojoExecutor: auto-unbox NPE on missing project index #12600

Description

@elharo

MojoExecutor: Auto-unbox NPE on missing project index

Found in: maven-4.0.x branch
File: impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoExecutor.java (line 374)
Severity: Medium

Description

The method executeForkedExecutions() auto-unboxes a potentially null Integer:

int index = projectIndex.getIndices().get(projectId);  // auto-unboxing of null

projectIndex.getIndices() returns a Map<String, Integer>. If projectId is not in the map, Map.get() returns null, which auto-unboxes to int, throwing a NullPointerException. This can happen if a forked execution references a project ID that is not in the reactor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions