Skip to content

writeScriptableOutput appends literal 'null' string for null classifier #1650

Description

@elharo

AbstractAnalyzeMojo.writeScriptableOutput() at line 550:

buf.append(scriptableFlag)
    .append(":")
    .append(pomFile)
    .append(":")
    .append(artifact.getDependencyConflictId())
    .append(":")
    .append(artifact.getClassifier())    // appends "null" string
    .append(":")
    .append(artifact.getBaseVersion())
    .append(":")
    .append(artifact.getScope())
    .append(System.lineSeparator());

artifact.getClassifier() returns null when no classifier is set. StringBuilder.append(null) appends the literal string "null" instead of an empty string. For dependencies without a classifier, the output contains ...:null:... instead of ...::..., which breaks script consumption of the output.

Note that writeDependencyXML() (line 515) correctly handles null classifier with an explicit null check before appending.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions