You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mo...@apache.org on 2017/03/15 15:15:16 UTC

zeppelin git commit: ZEPPELIN-2241: JDBC interpreter throws npe on connecting to any db that has a schema with "null" name

Repository: zeppelin
Updated Branches:
  refs/heads/master 1ec6e1265 -> 623b4ace9


ZEPPELIN-2241: JDBC interpreter throws npe on connecting to any db that has a schema with "null" name

### What is this PR for?
A few sentences describing the overall goals of the pull request's commits.
First time? Check out the contributing guide - https://zeppelin.apache.org/contribution/contributions.html

Prevents JDBC interpreter from throwing a stacktrace when the database has a schema with no name (null).

### What type of PR is it?
[Bug Fix]

### Todos
* [ ] - Task

### What is the Jira issue?
* Open an issue on Jira https://issues.apache.org/jira/browse/ZEPPELIN/
* Put link here, and add [ZEPPELIN-*Jira number*] in PR title, eg. [ZEPPELIN-533]

https://issues.apache.org/jira/browse/ZEPPELIN-2241

### How should this be tested?
Outline the steps to test the PR here.

Use JDBC interpreter to connect to any database that has a schema without a name. Apache Phoenix in particular has such a schema by default.

### 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: Randy Gelhausen <rg...@gmail.com>

Closes #2117 from randerzander/master and squashes the following commits:

49d33f9 [Randy Gelhausen] Removing comment per feedback
79d8a23 [Randy Gelhausen] Added comment to the change
0101296 [Randy Gelhausen] ZEPPELIN-2241: JDBC interpreter throws npe on connecting to any db that has a schema with "null" name


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/623b4ace
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/623b4ace
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/623b4ace

Branch: refs/heads/master
Commit: 623b4ace9e5c8f1667bd34c21b944b9d4636a2bd
Parents: 1ec6e12
Author: Randy Gelhausen <rg...@gmail.com>
Authored: Mon Mar 13 12:46:47 2017 -0400
Committer: Lee moon soo <mo...@apache.org>
Committed: Wed Mar 15 08:15:12 2017 -0700

----------------------------------------------------------------------
 jdbc/src/main/java/org/apache/zeppelin/jdbc/SqlCompleter.java | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/623b4ace/jdbc/src/main/java/org/apache/zeppelin/jdbc/SqlCompleter.java
----------------------------------------------------------------------
diff --git a/jdbc/src/main/java/org/apache/zeppelin/jdbc/SqlCompleter.java b/jdbc/src/main/java/org/apache/zeppelin/jdbc/SqlCompleter.java
index b0be70c..bf2a25e 100644
--- a/jdbc/src/main/java/org/apache/zeppelin/jdbc/SqlCompleter.java
+++ b/jdbc/src/main/java/org/apache/zeppelin/jdbc/SqlCompleter.java
@@ -111,6 +111,8 @@ public class SqlCompleter extends StringsCompleter {
       try {
         while (schemas.next()) {
           String schemaName = schemas.getString("TABLE_SCHEM");
+          if (schemaName == null)
+            schemaName = "";
           if (schemaFilter.equals("") || schemaFilter == null || schemaName.matches(
                   schemaFilter.replace("_", ".").replace("%", ".*?"))) {
             res.add(schemaName);