apache / apache/maven-remote-resources-plugin

Inconsistent resource-bundle descriptor parsing between validate() and downloadBundles()

Open
#272 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
17
Forks
18
Avg merge
6h 5m
Merged PRs (30d)
5

Description

## Summary
The bundle descriptor is validated with `StringUtils.split` (which collapses empty segments) but parsed later with `String.split(":")` (which preserves them), so certain malformed descriptors pass validation and then fail confusingly during resolution.

`src/main/java/org/apache/maven/plugin/resources/remote/AbstractProcessRemoteResourcesMojo.java`
- `validate()`: `StringUtils.split(artifactDescriptor, ":")` — line 728, empty tokens removed, so `group:artifact::type` counts as 3 tokens and passes the length check (3..5).
- `downloadBundles()`: `artifactDescriptor.split(":")` — line 822, empty tokens kept, so `group:artifact::type` yields `[group, artifact, "", type]` and resolution proceeds with an empty version.

## Impact
A descriptor such as `group:artifact::type` (missing version) passes `validate()` with a clear message never shown, then fails later with a confusing version/resolution error. Also in the reactor lookup, `s[0].equals(p.getGroupId())` can throw if `p.getGroupId()` is null.

## Suggested fix
Use the same splitting logic in both methods (and ideally a single parser that also checks that groupId/artifactId/version are non-empty), and null-guard the reactor comparison.

Contributor guide

No contributing guide indexed for this repository

Research direction

Read validate() and downloadBundles() in src/main/java/org/apache/maven/plugin/resources/remote/AbstractProcessRemoteResourcesMojo.java, focusing on the descriptor splitting at lines 728 and 822. Run the relevant Maven tests, then verify that malformed descriptors such as group:artifact::type are rejected consistently and that reactor lookup handles a null groupId safely.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.