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

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


The following commit(s) were added to refs/heads/branch-0.9 by this push:
     new 9a85c5f  [ZEPPELIN-5211] Fix authType in JDBCInterpreter
9a85c5f is described below

commit 9a85c5fefa2ace3997088504cb95aa37892b74db
Author: Zeno Zeng <[email protected]>
AuthorDate: Fri Jan 22 12:28:39 2021 +0800

    [ZEPPELIN-5211] Fix authType in JDBCInterpreter
    
    ### What is this PR for?
    
    Bug Fix: get `authType` using `getProperty` instead of 
`jdbcUserConfigurations.getPropertyMap(dbPrefix).getProperty`.
    
    According to the JDBC Interpreter document 
(https://github.com/apache/zeppelin/blob/master/docs/interpreter/jdbc.md), we 
should use `zeppelin.jdbc.auth.type`, but It is observed in the JDBC 
Interpreter that:
    - Setting `zeppelin.jdbc.auth.type`  to `KERBEROS` didn't work
    - Setting `default.zeppelin.jdbc.auth.type`  to `KERBEROS` works
    
    In `protected boolean isKerboseEnabled()`, we use 
`getProperty("zeppelin.jdbc.auth.type")`, but in `public Connection 
getConnection(String dbPrefix, InterpreterContext context)`, 
`jdbcUserConfigurations.getPropertyMap(dbPrefix).getProperty("zeppelin.jdbc.auth.type",
 "SIMPLE")` was used.
    
    ### What type of PR is it?
    Bug Fix
    
    ### Todos
    * [x] - Make jdbcIntegrationTest happy
    
    ### What is the Jira issue?
    * https://issues.apache.org/jira/browse/ZEPPELIN-5211
    
    ### How should this be tested?
    * Strongly recommended: add automated unit tests for any new or changed 
behavior
    * Outline any manual steps to test the PR here.
    
    ### Screenshots (if appropriate)
    
    ### Questions:
    * Does the licenses files need update?
    * Is there breaking changes for older versions?
    * Does this needs documentation?
    
    Author: Zeno Zeng <[email protected]>
    
    Closes #4029 from zenozeng/master and squashes the following commits:
    
    d94fdb643 [Zeno Zeng] remove StringUtils.defaultIfEmpty
    33a93bd54 [Zeno Zeng] Filter empty value properties
    fc1c6ac48 [Zeno Zeng] Update JDBCInterpreter.java: 
StringUtils.defaultIfEmpty(getProperty("zeppelin.jdbc.auth.type"), "SIMPLE")
    f05c6eca6 [Zeno Zeng] Fix authType in JDBCInterpreter
    
    (cherry picked from commit b139918e3ce3ad229e6f7698f26e57a4f98b9163)
    Signed-off-by: Jeff Zhang <[email protected]>
---
 jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java        | 2 +-
 .../main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java 
b/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
index 43a0d43..85d771e 100644
--- a/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
+++ b/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
@@ -509,7 +509,7 @@ public class JDBCInterpreter extends KerberosInterpreter {
     String url = properties.getProperty(URL_KEY);
     String connectionUrl = appendProxyUserToURL(url, user, dbPrefix);
 
-    String authType = properties.getProperty("zeppelin.jdbc.auth.type", 
"SIMPLE")
+    String authType = getProperty("zeppelin.jdbc.auth.type", "SIMPLE")
             .trim().toUpperCase();
     switch (authType) {
       case "SIMPLE":
diff --git 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java
 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java
index 2b5cb9a..0982cfc 100644
--- 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java
+++ 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java
@@ -627,7 +627,7 @@ public class InterpreterSetting {
     Properties jProperties = new Properties();
     Map<String, InterpreterProperty> iProperties = (Map<String, 
InterpreterProperty>) properties;
     for (Map.Entry<String, InterpreterProperty> entry : 
iProperties.entrySet()) {
-      if (entry.getValue().getValue() != null) {
+      if (entry.getValue().getValue() != null && 
StringUtils.isNotBlank(entry.getValue().getValue().toString())) {
         jProperties.setProperty(entry.getKey().trim(),
             entry.getValue().getValue().toString().trim());
       }

Reply via email to