Skip to content

OverlayManager.compareOverlayWithArtifact() treats null classifier as literal "null" string #621

Description

@elharo

Bug Description

OverlayManager.compareOverlayWithArtifact() at src/main/java/org/apache/maven/plugins/war/overlay/OverlayManager.java lines 205-206 uses Objects.toString(overlay.getClassifier()) which converts a null classifier to the literal string "null" rather than "".

The adjacent comment explicitly states that null and "" should be treated as equal for classifier comparison (MWAR-241), but this code treats them as distinct.

Impact

Overlay-to-artifact matching fails when one side has a null classifier and the other has an empty string.

Code

// Line 205-206
Objects.toString(overlay.getClassifier())
// When overlay.getClassifier() is null, this returns "null" not ""

Expected behavior

Use Objects.toString(overlay.getClassifier(), "") so that null is treated as empty string, matching the documented intent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions