Skip to content

NullPointerException in AbstractEarMojo.isArtifactRegistered() when module artifact is null #519

Description

@elharo

Description

In AbstractEarMojo.java:317, isArtifactRegistered() can throw a NullPointerException:

return currentList.stream().anyMatch(em -> em.getArtifact().equals(a));

EarModule.getArtifact() is documented as returning null until the artifact is resolved. If a module in currentList has not been resolved, .getArtifact() returns null and null.equals(a) throws an NPE.

Expected behavior

Add a null guard:

return currentList.stream().anyMatch(em -> em.getArtifact() != null && em.getArtifact().equals(a));

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