This is an automated email from the ASF dual-hosted git repository.
lmccay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/knox.git
The following commit(s) were added to refs/heads/master by this push:
new 294cd1b KNOX-2204 - KnoxLine NPE list datasources when directories
don't exist (#246)
294cd1b is described below
commit 294cd1b14a0392b76897320ea8289e06c9a9bc77
Author: lmccay <[email protected]>
AuthorDate: Wed Jan 29 00:36:07 2020 -0500
KNOX-2204 - KnoxLine NPE list datasources when directories don't exist
(#246)
* KNOX-1742 - add to knoxshell usage rendering
* KNOX-2204 - KnoxLine NPE list datasources when directories don't exist
---
.../src/main/java/org/apache/knox/gateway/shell/jdbc/KnoxLine.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git
a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/jdbc/KnoxLine.java
b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/jdbc/KnoxLine.java
index 0afb9d9..433c889 100644
---
a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/jdbc/KnoxLine.java
+++
b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/jdbc/KnoxLine.java
@@ -132,7 +132,12 @@ public class KnoxLine {
private void listDataSources() {
Map<String, KnoxDataSource> sources = getDataSources();
- sources.forEach((name, ds)->System.out.println("Name : " + name + " : " +
ds.getConnectStr()));
+ if (sources != null) {
+ sources.forEach((name, ds)->System.out.println("Name : " + name + " : "
+ ds.getConnectStr()));
+ }
+ else {
+ System.out.println("No datasources configured. Use :ds add {ds-name}
{connectStr} {driver} {authnType: none|basic}");
+ }
}
private Map<String, KnoxDataSource> getDataSources() {