Repository navigation
fix: fail typed JavaScript results on conversion errors - #26920
totally-not-ai[bot] wants to merge 4 commits into
Conversation
A typed then or toCompletableFuture on PendingJavaScriptResult threw the conversion error from the result handler, so the future never completed and handlers added after it were skipped. Route the error to the error handler instead, log it when there is none, and make JacksonCodec.decodeAs(JsonNode, Class) report a JSON node type mismatch as IllegalArgumentException like the other failures. Part of #26919
|
Added a Javadoc description to the new |
|
|
Documented the parameters and return value of the |



Part of #26919
Behavior deviation · flow-server · apps using typed
executeJs/callJsFunctionresultsWhen a typed JavaScript result can't be converted to the requested type (for example the browser returns
"abc"for anInteger), the conversion error escaped the result handler. A typedtoCompletableFuture(...)then never completed, sojoin()/get()hung andwhenCompletecallbacks never ran, and a typedthen(..., errorHandler)threw instead of calling the error handler.Risks:
JavaScriptException) instead of being thrown from the response handling; with no error handler it is logged as a warning.JacksonCodec.decodeAs(JsonNode, Class)(internal) throwsIllegalArgumentExceptioninstead ofClassCastExceptionwhen the target is a JSON node type the value isn't.✅ No public API change, no serialization or threading impact.
Typed
then(Class|TypeReference, …)decode inside a try and routeIllegalArgumentExceptionto the error handler; handlers added after it still run.Typed
toCompletableFuture(Class|TypeReference)reuse the typedthen, so conversion errors complete the future exceptionally.Exceptions thrown by the user's own result handler still propagate unchanged.
decodeAs(JsonNode, Class)reports a node type mismatch (e.g.ObjectNodefor an array) asIllegalArgumentExceptionnaming the node type.The other part of the issue (aligning null-argument checks and JSON-null handling across the three
decodeAsoverloads) is left for after #26890, which touches the same code.Fixes #26919