#2312: Fix NPE in Uv.setEnvironment and suppress errors during auto-c… - #2332
Open
krystynaShatkovska wants to merge 3 commits into
Open
#2312: Fix NPE in Uv.setEnvironment and suppress errors during auto-c…#2332krystynaShatkovska wants to merge 3 commits into
krystynaShatkovska wants to merge 3 commits into
Conversation
… auto-completion Co-Authored-By: Capgemini Sovereign AI Platform
…ommandlets The original fix wrapped both activateLogging() and step.error() inside the isProcessableOutput check. However, step.error(t, true) logs at DEBUG level (not ERROR) and is needed for proper step tracking and test assertions. Only activateLogging() should be skipped to prevent errors from appearing in the terminal during auto-completion.
Collaborator
Coverage Report for CI Build 31788178452Warning No base build found for commit Coverage: 72.864%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsRequires a base build to compare against. How to fix this → 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 2312
Implemented changes:
Uv.java - Added a null check on getSoftwarePath(). If it is null, setEnvironment() returns early instead of crashing.
AbstractIdeContext.java - In the catch (Throwable) block, exceptions during processable-output commandlets (like CompleteCommandlet) are no longer logged to stderr. The exception
still re-throws, but nothing reaches the user's screen, keeping auto-completion output clean.
Testing instructions
Test 1: Auto-completion outside an IDEasy project
Navigate to a directory that is NOT inside an IDEasy project
cd /tmp
Trigger auto-completion for Python versions (no IDE_HOME)
ide complete install python ""
Expected: Clean output with version suggestions only, no error messages, no NPE.
Before fix: NullPointerException error printed to console.
Test 2: Auto-completion inside an IDEasy project
Navigate to an IDEasy project
cd
ide complete install python ""
Expected: Clean output with version suggestions only.
Test 3: Normal error display for regular commands
cd /tmp
ide install python invalid-version-xyz
Expected: Error IS displayed normally (the user should see it for real commands, only auto-completion suppresses errors).
Test 4: Uv.setEnvironment with no IDE_HOME
cd /tmp
This should not crash even if it triggers uv environment setup
ide complete install python ""
Expected: No crash, clean output.
Checklist for this PR
mvn clean testlocally all tests pass and build is successful#«issue-id»: «brief summary»(e.g.#921: fixed setup.batand notfeature/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
internalpom.xmlfiles or otherwise if runtime dependencies changed, you have updated our LICENSE.asciidoc