Copilot commented on code in PR #17716:
URL:
https://github.com/apache/dolphinscheduler/pull/17716#discussion_r2562517226
##########
dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTask.java:
##########
@@ -74,6 +74,8 @@ public void handle(TaskCallBack taskCallBack) throws
TaskException {
OkHttpResponse httpResponse = sendRequest();
validateResponse(httpResponse.getBody(), httpResponse.getStatusCode());
+
+ taskExecutionContext.setVarPool(httpParameters.getVarPool());
Review Comment:
The `setVarPool()` call will not execute when validation fails. The
`validateResponse()` method sets `exitStatusCode = EXIT_CODE_FAILURE` and
returns early in failure scenarios (lines 91-92, 99-100, 107-108, 115-116),
preventing varPool from being set. This means output parameters won't be
available to downstream tasks even though the HTTP request succeeded and
`addDefaultOutput()` was called. Consider moving `setVarPool()` before
`validateResponse()` or restructuring to ensure it's always called after
`sendRequest()`.
```suggestion
taskExecutionContext.setVarPool(httpParameters.getVarPool());
validateResponse(httpResponse.getBody(),
httpResponse.getStatusCode());
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]