From 7d728be05b2fc7e931ee81e4495ae185b7a09090 Mon Sep 17 00:00:00 2001 From: Mark Vieira Date: Mon, 6 Jan 2025 08:48:29 -0800 Subject: [PATCH] Simplify --- .../org/elasticsearch/packaging/util/docker/DockerRun.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/qa/packaging/src/test/java/org/elasticsearch/packaging/util/docker/DockerRun.java b/qa/packaging/src/test/java/org/elasticsearch/packaging/util/docker/DockerRun.java index a875709e49f22..554ae871ea9fa 100644 --- a/qa/packaging/src/test/java/org/elasticsearch/packaging/util/docker/DockerRun.java +++ b/qa/packaging/src/test/java/org/elasticsearch/packaging/util/docker/DockerRun.java @@ -117,11 +117,7 @@ String build() { // Add default java opts for (String envVar : List.of("CLI_JAVA_OPTS", "ES_JAVA_OPTS")) { - if (this.envVars.containsKey(envVar)) { - this.envVars.put(envVar, this.envVars.get(envVar) + " " + DEFAULT_JAVA_OPTS); - } else { - this.envVars.put(envVar, DEFAULT_JAVA_OPTS); - } + this.envVars.put(envVar, this.envVars.getOrDefault(envVar, "") + " " + DEFAULT_JAVA_OPTS); } this.envVars.forEach((key, value) -> cmd.add("--env " + key + "=\"" + value + "\""));