apache / apache/maven-shared-jar
Version extraction in FilenameExposer truncates multi-digit version numbers
- Dominant language
- Java
- Stars
- 4
- Forks
- 9
- Avg merge
- 2h 46m
- Merged PRs (30d)
- 3
Description
In `FilenameExposer.java:35-40`, the regex only matches a single digit:
```java
private static final Pattern VERSION_PATTERN = Pattern.compile("-\\\\d"); // only matches single digit!
// ...
identification.addVersion(filename.substring(mat.end() - 1));
```
For a file like `my-lib-12.3.4.jar`:
- `mat.find()` matches `-1` at position 6-8
- `mat.end() - 1` = 7 ⇒ `filename.substring(7)` = `2.3.4`
The expected result is `12.3.4`. The pattern `-\\\\d` only matches `-` followed by a **single** digit, so any version starting with a multi-digit number (e.g., `10`, `12`, `21`) gets its first digit lopped off. This produces incorrect artifact identification for versions >= 10.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in FilenameExposer.java:35-40 and reproduce the issue with my-lib-12.3.4.jar. Trace how the regex match and substring determine the extracted version, then verify that multi-digit versions retain the complete value and that existing tests still pass.
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
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 82/100