From a2b45c45b8c0a7e6244f2aadae42a9ec2e61071d Mon Sep 17 00:00:00 2001 From: hengyunabc Date: Thu, 22 Oct 2020 15:04:59 +0800 Subject: [PATCH] fix ArthasAgent NullPointerException. #1546 --- .../java/com/taobao/arthas/agent/attach/ArthasAgent.java | 5 ++++- .../java/com/taobao/arthas/core/server/ArthasBootstrap.java | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/arthas-agent-attach/src/main/java/com/taobao/arthas/agent/attach/ArthasAgent.java b/arthas-agent-attach/src/main/java/com/taobao/arthas/agent/attach/ArthasAgent.java index 805b55080..bcd0af43b 100644 --- a/arthas-agent-attach/src/main/java/com/taobao/arthas/agent/attach/ArthasAgent.java +++ b/arthas-agent-attach/src/main/java/com/taobao/arthas/agent/attach/ArthasAgent.java @@ -45,7 +45,10 @@ public class ArthasAgent { public ArthasAgent(Map configMap, String arthasHome, boolean slientInit, Instrumentation instrumentation) { - this.configMap = configMap; + if (configMap != null) { + this.configMap = configMap; + } + this.arthasHome = arthasHome; this.slientInit = slientInit; this.instrumentation = instrumentation; diff --git a/core/src/main/java/com/taobao/arthas/core/server/ArthasBootstrap.java b/core/src/main/java/com/taobao/arthas/core/server/ArthasBootstrap.java index 108965b2b..cedbd9323 100644 --- a/core/src/main/java/com/taobao/arthas/core/server/ArthasBootstrap.java +++ b/core/src/main/java/com/taobao/arthas/core/server/ArthasBootstrap.java @@ -189,7 +189,10 @@ public class ArthasBootstrap { * https://github.com/alibaba/arthas/issues/986 * */ - Map copyMap = new HashMap(argsMap); + Map copyMap = new HashMap(); + if (argsMap != null) { + copyMap.putAll(argsMap); + } // 添加 arthas.home if (!copyMap.containsKey(ARTHAS_HOME_PROPERTY)) { copyMap.put(ARTHAS_HOME_PROPERTY, arthasHome());