Java Runtime now incorrectly reports Cannot read field "stderr" because "consoleOutput" is null
#4801
Labels
bug
This issue is a bug.
needs-triage
This issue or PR still needs to be triaged.
potential-regression
Marking this issue as a potential regression to be checked by team member
Describe the bug
In the java version of jsii 1.109.0, the runner now reports:
on every run.
The way the jsii Java runner works is that there's a thread that reads standard error for json objects. It reads each line, tries to parse them to json, and if it fails with an exception, it will print the line instead.
There's a small mistake in the runtime, where the buffer is flushed on EOF, even if it is empty. This would have failed the json parsing, and printed a newline to standard error (probably no one noticed this - I certainly didn't).
Unfortunately, Jackson-Databind 2.18.3 contains a change, where json nodes that aren't present will now return
null
instead of throwing an exception as they did previously. This changes the behaviour for empty string.Regression Issue
Expected Behavior
No errors to be printed on a successful run
Current Behavior
The following error is printed to standard out
Reproduction Steps
Run any java code that calls jsii with v1.109.0
Possible Solution
The fix is twofold:
objectMapper.treeToValue
hereAdditional Information/Context
Happy to produce a PR if you like
SDK version used
1.109.0
Environment details (OS name and version, etc.)
openjdk 23.0.1, node v22.9.0, MacOS 14.4.1
The text was updated successfully, but these errors were encountered: