From a4dce7af439f3c3459c96ae10adec3166e6d0d43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E5=86=B0?= <741531906@qq.com> Date: Fri, 15 Dec 2023 09:59:03 +0000 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3env=E5=87=BA=E7=8E=B0value=3D?= =?UTF-8?q?=3Dnull=E6=8A=A5=E9=94=99=E7=A9=BA=E6=8C=87=E9=92=88=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 周冰 <741531906@qq.com> --- .../common/src/main/java/org/dromara/jpom/util/CommandUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/common/src/main/java/org/dromara/jpom/util/CommandUtil.java b/modules/common/src/main/java/org/dromara/jpom/util/CommandUtil.java index ec51f3fb7..ce42746e6 100644 --- a/modules/common/src/main/java/org/dromara/jpom/util/CommandUtil.java +++ b/modules/common/src/main/java/org/dromara/jpom/util/CommandUtil.java @@ -361,10 +361,10 @@ public class CommandUtil { processBuilder.redirectErrorStream(true); processBuilder.command(command); Optional.ofNullable(baseDir).ifPresent(processBuilder::directory); + Map environment = processBuilder.environment(); // 新增逻辑,将env和environment里value==null替换成空字符,防止putAll出现空指针报错 env.replaceAll((k,v)-> Optional.ofNullable(v).orElse(StrUtil.EMPTY)); environment.replaceAll((k,v)-> Optional.ofNullable(v).orElse(StrUtil.EMPTY)); - Map environment = processBuilder.environment(); // 环境变量 Optional.ofNullable(env).ifPresent(environment::putAll); //