apache / apache/maven-artifact-plugin

compare: NPE when buildinfo length/sha512 entry is missing

Open Beginner friendly
#244 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
14
Forks
23
Avg merge
1h 27m
Merged PRs (30d)
8

Description

In `CompareMojo.checkArtifact()` (line 291):

```java
} else if (!actualLength.equals(referenceLength)) {
```

`actualLength` comes from `actual.remove(prefix + ".length")` and can be `null` when the freshly generated buildinfo is missing a `length` entry (for example after printer issues). In that case `actualLength.equals(...)` throws a `NullPointerException` instead of reporting the artifact as mismatched/missing.

Same applies to `actualSha512` (line 293).

Suggested fix: use `Objects.equals(actualLength, referenceLength)` / `Objects.equals(actualSha512, referenceSha512)`.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in CompareMojo.checkArtifact() around lines 291-293 and trace how actualLength and actualSha512 are removed from the generated buildinfo data. Exercise cases where either entry is missing, then verify the comparison reports the artifact as mismatched or missing without throwing a NullPointerException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
86/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.