[MNG-8129] Handle InvalidPathException for broken relativePath on Windows - #12741
Open
gnodet wants to merge 2 commits into
Open
[MNG-8129] Handle InvalidPathException for broken relativePath on Windows#12741gnodet wants to merge 2 commits into
gnodet wants to merge 2 commits into
Conversation
…dows Catch InvalidPathException when resolving relative parent paths that contain characters illegal on certain platforms (e.g. ':' on Windows). Some POMs on Maven Central have nonsensical <relativePath> values like "org.apache:apache" which cause Path.resolve() to throw on Windows. Return null instead, matching the existing behavior on platforms where the resolve succeeds but the path doesn't exist. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Aug 12, 2026
Reject <relativePath> values containing characters that are illegal in filesystem paths (: " < > | ? *) during model validation. This catches nonsensical values like "org.apache:apache" early, with a clear error message, complementing the InvalidPathException catch in the resolution layer. The check uses errOn31 severity — WARNING for compat (STRICT=3.0) and ERROR for the new API (STRICT=4.2). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gnodet
marked this pull request as ready for review
August 13, 2026 02:50
gnodet
commented
Aug 13, 2026
gnodet
left a comment
Contributor
Author
There was a problem hiding this comment.
Verdict: APPROVE ✅
Clean backport of #12740 to maven-4.0.x. Catches InvalidPathException when resolving relativePath values with illegal filesystem characters (e.g. org.apache:apache) and adds early model validation to reject such values before resolution.
Key observations:
ILLEGAL_RELATIVE_PATH_CHARScorrectly excludes\and/since those are valid path separators in relativePath values.- The
errOn31severity is properly calibrated: WARNING in compat module (backward compatibility for Maven 3.x) and ERROR in impl module (strict validation for Maven 4.x). - Test POMs are identical between compat/impl modules, with tests correctly targeting
validateRaw(compat) andvalidateFile(impl), matching each module's validation architecture. - Consistent with the already-approved PRs #12739 (3.10.x catch), #12740 (master catch + validation), and #12742 (3.10.x validation).
All 22 CI jobs pass across Linux/macOS/Windows and Java 17/21/25.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of gnodet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Backport of #12740 to
maven-4.0.xfor RC-7.InvalidPathExceptioninBuildPathSource.resolve()andFileModelSource.getRelatedSource()when the<relativePath>value contains characters illegal on certain platforms (e.g.:on Windows)nullinstead of throwing, matching the behavior on platforms wherePath.resolve()succeeds but the path doesn't exist<relativePath>values likeorg.apache:apache(e.g.artemis-project-2.33.0.pom) which trigger this on WindowsFixes https://issues.apache.org/jira/browse/MNG-8129
Related: #12738
🤖 Generated with Claude Code