Skip to content

Fix #134: add regression test for multi-digit version extraction - #156

Open
elharo wants to merge 1 commit into
masterfrom
fix/issue-134-filename-exposer-multidigit-version
Open

Fix #134: add regression test for multi-digit version extraction#156
elharo wants to merge 1 commit into
masterfrom
fix/issue-134-filename-exposer-multidigit-version

Conversation

@elharo

@elharo elharo commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Closes #134

Summary

Issue #134 reports that FilenameExposer truncates multi-digit version numbers (e.g. my-lib-12.3.4.jar would yield version 2.3.4).

Investigation showed the described behavior does not reproduce. FilenameExposer uses filename.substring(mat.end() - 1), where mat.end() - 1 is the index of the first digit matched by the -\\d pattern. substring() therefore includes the full multi-digit version, so my-lib-12.3.4.jar correctly yields 12.3.4, my-lib-10.jar yields 10, etc. No source change is required.

Test

Adds FilenameExposerTest, which builds JARs in memory with version-specific filenames and asserts FilenameExposer extracts the full version:

  • my-lib-12.3.4.jar12.3.4
  • my-lib-10.jar10
  • my-lib-21.5.7.jar21.5.7
  • my-lib-9.0.jar9.0
  • my-lib.jar → no version

These tests document the expected behavior and guard against regressions.

@elharo
elharo requested a review from markt-asf August 7, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Version extraction in FilenameExposer truncates multi-digit version numbers

1 participant