Skip to content

Commit 19850fa

Browse files
苏义超ruanwenjun
authored andcommitted
add string blank check
1 parent dbb7c4c commit 19850fa

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

  • dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils

dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/ProcessUtils.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,14 @@ public static boolean kill(@NonNull TaskExecutionContext request) {
115115
// Get all child processes
116116
String pids = getPidsStr(processId);
117117
String[] pidArray = PID_PATTERN.split(pids);
118-
if (pidArray.length == 0) {
118+
if (StringUtils.isBlank(pids) || pidArray.length == 0) {
119119
log.warn("No valid PIDs found for process: {}", processId);
120120
return true;
121121
}
122122

123123
// Convert PID string to list of integers
124-
List<Integer> pidList = Arrays.stream(pidArray).map(Integer::parseInt).collect(Collectors.toList());
124+
List<Integer> pidList = Arrays.stream(pidArray).filter(StringUtils::isNotBlank).map(Integer::parseInt)
125+
.collect(Collectors.toList());
125126

126127
// 1. Try to terminate gracefully (SIGINT)
127128
boolean gracefulKillSuccess = sendKillSignal("SIGINT", pidList, request.getTenantCode());

0 commit comments

Comments
 (0)