This is an automated email from the ASF dual-hosted git repository.
pdallig 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 3bf19f4414 [ZEPPELIN-6002] Fix completer NPE (#4730)
3bf19f4414 is described below
commit 3bf19f4414cf2653d79fbc36abef6e9a022a76a6
Author: Manhua <[email protected]>
AuthorDate: Fri Mar 15 14:51:11 2024 +0800
[ZEPPELIN-6002] Fix completer NPE (#4730)
Co-authored-by: Philipp Dallig <[email protected]>
---
.../org/apache/zeppelin/jdbc/SqlCompleter.java | 25 +++++++++++-----------
1 file changed, 12 insertions(+), 13 deletions(-)
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 d0db613d15..b41207a552 100644
--- a/jdbc/src/main/java/org/apache/zeppelin/jdbc/SqlCompleter.java
+++ b/jdbc/src/main/java/org/apache/zeppelin/jdbc/SqlCompleter.java
@@ -207,8 +207,7 @@ public class SqlCompleter {
}
}
- public static Set<String> getSqlKeywordsCompletions(DatabaseMetaData meta)
throws IOException,
- SQLException {
+ public static Set<String> getSqlKeywordsCompletions(DatabaseMetaData meta)
throws IOException {
// Add the default SQL completions
String keywords =
new BufferedReader(new InputStreamReader(
@@ -217,11 +216,11 @@ public class SqlCompleter {
Set<String> completions = new TreeSet<>();
if (null != meta) {
- // Add the driver specific SQL completions
- String driverSpecificKeywords =
- "/" + meta.getDriverName().replace(" ", "-").toLowerCase() +
"-sql.keywords";
- logger.info("JDBC DriverName:" + driverSpecificKeywords);
try {
+ // Add the driver specific SQL completions
+ String driverSpecificKeywords =
+ "/" + meta.getDriverName().replace(" ", "-").toLowerCase() +
"-sql.keywords";
+ logger.info("JDBC DriverName: {}", driverSpecificKeywords);
if (SqlCompleter.class.getResource(driverSpecificKeywords) != null) {
String driverKeywords =
new BufferedReader(new InputStreamReader(
@@ -229,35 +228,35 @@ public class SqlCompleter {
.readLine();
keywords += "," + driverKeywords.toUpperCase();
}
- } catch (Exception e) {
+ } catch (IOException | SQLException e) {
logger.debug("fail to get driver specific SQL completions for " +
- driverSpecificKeywords + " : " + e, e);
+ meta.getClass().getName() + " : " + e, e);
}
// Add the keywords from the current JDBC connection
try {
keywords += "," + meta.getSQLKeywords();
- } catch (Exception e) {
+ } catch (SQLException e) {
logger.debug("fail to get SQL key words from database metadata: " + e,
e);
}
try {
keywords += "," + meta.getStringFunctions();
- } catch (Exception e) {
+ } catch (SQLException e) {
logger.debug("fail to get string function names from database
metadata: " + e, e);
}
try {
keywords += "," + meta.getNumericFunctions();
- } catch (Exception e) {
+ } catch (SQLException e) {
logger.debug("fail to get numeric function names from database
metadata: " + e, e);
}
try {
keywords += "," + meta.getSystemFunctions();
- } catch (Exception e) {
+ } catch (SQLException e) {
logger.debug("fail to get system function names from database
metadata: " + e, e);
}
try {
keywords += "," + meta.getTimeDateFunctions();
- } catch (Exception e) {
+ } catch (SQLException e) {
logger.debug("fail to get time date function names from database
metadata: " + e, e);
}