#2088: skip malformed PATH entries instead of failing with InvalidPathException#2089
Open
maybeec wants to merge 1 commit into
Open
#2088: skip malformed PATH entries instead of failing with InvalidPathException#2089maybeec wants to merge 1 commit into
maybeec wants to merge 1 commit into
Conversation
…alidPathException SystemPath called Path.of(segment) for every PATH entry without guarding against InvalidPathException. A single malformed entry (e.g. one containing an illegal character such as a newline on Windows or a NUL byte on any OS) aborted the whole SystemPath construction and therefore all of IDEasy. Invalid PATH entries are now skipped with a warning while all valid entries continue to be processed.
Collaborator
Coverage Report for CI Build 28396032515Coverage increased (+0.01%) to 71.357%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions11 previously-covered lines in 1 file lost coverage.
Coverage Stats💛 - Coveralls |
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.
This PR fixes #2088
Implemented changes:
SystemPathnow guards the per-segmentPath.of(segment)call againstInvalidPathException. A single malformedPATHentry (e.g. one containing an illegal character such as a newline on Windows or aNULbyte on any OS) is now skipped with a warning instead of throwing and aborting the wholeSystemPathconstruction — which previously took down all of IDEasy during context setup.SystemPathTest#testConstructorSkipsMalformedPathEntryAndKeepsValidOnesthat builds aSystemPathfrom aPATHcontaining a malformed entry and asserts the valid entries are kept and a warning is logged.CHANGELOG.adocentry.Testing instructions
Please add conscise, understandable instructions on how a reviewer can test/verify the functionality of your contribution here:
mvn -pl cli -am test -Dtest=SystemPathTest— all tests pass, including the newtestConstructorSkipsMalformedPathEntryAndKeepsValidOnes.try/catcharoundPath.of(segment)inSystemPath(~line 99) back toPath path = Path.of(segment);and re-run step 1 — the new test fails withInvalidPathException. Restore the fix afterwards.PATHthat contains a malformed entry (e.g. an embedded newline) and run anyidecommand: IDEasy now logsWARNING Ignoring invalid PATH entry '...'and continues instead of aborting.Checklist for this PR
Make sure everything is checked before merging this PR. For further info please also see
our DoD.
mvn clean testlocally all tests pass and build is successful#«issue-id»: «brief summary»(e.g.#921: fixed setup.bat). If no issue ID exists, title only.In Progressand assigned to you or there is no issue (might happen for very small PRs)with
internal