apache / apache/maven-mvnd

String index out of range when paramter is malformed

Open
#919 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
3.5k
Forks
250
Avg merge
16h 22m
Merged PRs (30d)
36

Description

When passing module list with leading `,` mvnd will crash with `java.lang.StringIndexOutOfBoundsException: String index out of range: 0`, but maven works fine.

### To reproduce:
```bash
# mvnd crashes
$ mvnd package -pl ,a,b
Unable to find the root directory. Create a .mvn directory in the root directory or add the root="true" attribute on the root project's model to identify it.
java.lang.StringIndexOutOfBoundsException: String index out of range: 0

# mvn doesn't crash
$ mvn package -pl ,a,b
[INFO] Scanning for projects...
...
```

### Version:

mvnd: `Apache Maven 4.0.0-alpha-8 (a2cbf4873a99c1aca7e3908086fe53b17865f07a)`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing `mvnd package -pl ,a,b` and compare its behavior with `mvn package -pl ,a,b`. Trace the handling of the malformed module list and ensure the command no longer throws StringIndexOutOfBoundsException, while preserving the successful Maven-compatible behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.