Browse Source

HADOOP-19305: Fix ProcessEnvironment ClassCastException in Shell.java (#7106) Contributed by Butao Zhang.

Signed-off-by: Shilun Fan <slfan1989@apache.org>
Butao Zhang 3 tháng trước cách đây
mục cha
commit
1bd4835a3d

+ 3 - 1
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java

@@ -977,7 +977,9 @@ public abstract class Shell {
       builder.environment().clear();
     }
 
-    builder.environment().putAll(this.environment);
+    if (!environment.isEmpty()) {
+      builder.environment().putAll(this.environment);
+    }
 
     if (dir != null) {
       builder.directory(this.dir);