apache / apache/maven-dependency-plugin

writeScriptableOutput appends literal 'null' string for null classifier

Open
#1,650 0 comments 0 reactions 1 assignee Claimed by @elharo View on GitHub
bug
Dominant language
Java
Stars
175
Forks
196
Avg merge
19h 30m
Merged PRs (30d)
5

Description

`AbstractAnalyzeMojo.writeScriptableOutput()` at line 550:

```java
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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.