Repository navigation
FIX @W-24886726@ [BUG][code-analyzer] Java auto-detection parses java -version on 'exit' and reads truncated stderr: JAVA_TOOL_OPTIONS notice yields "Java v8.0.0" - #521
Open
nikhil-mittal-165 wants to merge 3 commits into
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Git2Gus App is installed but the |
java -version on 'exit' and reads truncated stderr: JAVA_TOOL_OPTIONS notice yields "Java v8.0.0"java -version on 'exit' and reads truncated stderr: JAVA_TOOL_OPTIONS notice yields "Java v8.0.0"
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
nikhil-mittal-165
marked this pull request as ready for review
November 12, 2026 12:40
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
aruntyagiTutu
approved these changes
Nov 12, 2026
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
Addresses code-analyzer issue 2110.
Root Cause
RuntimeJavaVersionIdentifier.identifyJavaVersionincode-analyzer-pmd-engine/src/JavaVersionIdentifier.tsparses collected stderr in the child processexithandler. Node documents that stdio streams may still be open atexit, so stderr can be incomplete. WhenJAVA_TOOL_OPTIONSis set, the JVM prints aPicked up JAVA_TOOL_OPTIONS: ...line first. If only that chunk has arrived, theversionregex does not match and thesemver.coercefallback takes the first number from the notice (8 from-Dfile.encoding=UTF-8), producing Java v8.0.0. The result is also cached. Thecloseevent fires after the streams are drained;JavaCommandExecutorin code-analyzer-engine-api already uses it.Fix
Use the child process
closeevent instead ofexitso stderr is fully drained before parsing the java version. Added a regression test for a late-arriving version line after theJAVA_TOOL_OPTIONSnotice. The 81 other pmd-engine test failures also occur on origin/dev.Testing
npx jest test/JavaVersionIdentifier.test.ts: 8 passed, 8 totalFunctional Testing Evidence
openjdk 25.0.5line) - fixed build viaclosereturns 25.0.5,exit-patched copy returns 8.0.0, close stderr containsopenjdk version 25.0.5- PASSnpx jest test/JavaVersionIdentifier.test.ts- 8 passed, 8 total - PASSOverall Status: PASS ✅
Files Changed
packages/code-analyzer-pmd-engine/src/JavaVersionIdentifier.tspackages/code-analyzer-pmd-engine/test/JavaVersionIdentifier.test.ts🤖 Generated with Claude Code