This is an automated email from the ASF dual-hosted git repository.

zjffdu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zeppelin.git


The following commit(s) were added to refs/heads/master by this push:
     new c5a32db  [ZEPPELIN-4644]. Don't overwrite system's env if the env 
property value is empty
c5a32db is described below

commit c5a32db94d0a81ec214c4f045cc70e0882ef64af
Author: Jeff Zhang <zjf...@apache.org>
AuthorDate: Wed Feb 26 15:58:48 2020 +0800

    [ZEPPELIN-4644]. Don't overwrite system's env if the env property value is 
empty
    
    ### What is this PR for?
    
    It is just a trivial PR that just only overwrite system env when the env 
property value is not empty.
    
    ### What type of PR is it?
    [ Improvement ]
    
    ### Todos
    * [ ] - Task
    
    ### What is the Jira issue?
    * https://issues.apache.org/jira/browse/ZEPPELIN-4644
    
    ### How should this be tested?
    * Manually tested
    
    ### Screenshots (if appropriate)
    
    ### Questions:
    * Does the licenses files need update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? No
    
    Author: Jeff Zhang <zjf...@apache.org>
    
    Closes #3662 from zjffdu/ZEPPELIN-4644 and squashes the following commits:
    
    0dcf526da [Jeff Zhang] [ZEPPELIN-4644]. Don't overwrite system's env if the 
env property value is empty
---
 .../interpreter/launcher/StandardInterpreterLauncher.java        | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/launcher/StandardInterpreterLauncher.java
 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/launcher/StandardInterpreterLauncher.java
index 78eca55..98485f6 100644
--- 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/launcher/StandardInterpreterLauncher.java
+++ 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/launcher/StandardInterpreterLauncher.java
@@ -18,6 +18,7 @@
 
 package org.apache.zeppelin.interpreter.launcher;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.zeppelin.conf.ZeppelinConfiguration;
 import org.apache.zeppelin.interpreter.InterpreterOption;
 import org.apache.zeppelin.interpreter.InterpreterRunner;
@@ -90,9 +91,11 @@ public class StandardInterpreterLauncher extends 
InterpreterLauncher {
 
   public Map<String, String> buildEnvFromProperties(InterpreterLaunchContext 
context) throws IOException {
     Map<String, String> env = new HashMap<>();
-    for (Object key : context.getProperties().keySet()) {
-      if (RemoteInterpreterUtils.isEnvString((String) key)) {
-        env.put((String) key, context.getProperties().getProperty((String) 
key));
+    for (Map.Entry entry : context.getProperties().entrySet()) {
+      String key = (String) entry.getKey();
+      String value = (String) entry.getValue();
+      if (RemoteInterpreterUtils.isEnvString(key) && 
!StringUtils.isBlank(value)) {
+        env.put(key, value);
       }
     }
     env.put("INTERPRETER_GROUP_ID", context.getInterpreterGroupId());

Reply via email to