Skip to content

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

Description

@elharo

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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