Skip to content

Commit 6ecde23

Browse files
author
苏义超
committed
do with NumberFormatException
1 parent 5fbab09 commit 6ecde23

1 file changed

Lines changed: 10 additions & 1 deletion

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: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,16 @@ public static boolean kill(@NonNull TaskExecutionContext request) {
121121
}
122122

123123
// Convert PID string to list of integers
124-
List<Integer> pidList = Arrays.stream(pidArray).filter(StringUtils::isNotBlank).map(Integer::parseInt)
124+
List<Integer> pidList = Arrays.stream(pidArray).filter(StringUtils::isNotBlank)
125+
.map(s -> {
126+
try {
127+
return Integer.parseInt(s.trim());
128+
} catch (NumberFormatException e) {
129+
log.warn("Invalid PID string ignored: {}", s);
130+
return null;
131+
}
132+
})
133+
.filter(Objects::nonNull)
125134
.collect(Collectors.toList());
126135

127136
// 1. Try to terminate gracefully (SIGINT)

0 commit comments

Comments
 (0)