Mercurial > hg > monetdb-java
changeset 466:1bb3885dd240
Defensive line, if the console is not available don't attempt to read from it
author | Pedro Ferreira <pedro.ferreira@monetdbsolutions.com> |
---|---|
date | Tue, 13 Apr 2021 18:34:49 +0200 (2021-04-13) |
parents | ed27270f5cdf |
children | 171144a26ba0 |
files | src/main/java/org/monetdb/client/JdbcClient.java |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/org/monetdb/client/JdbcClient.java +++ b/src/main/java/org/monetdb/client/JdbcClient.java @@ -18,6 +18,7 @@ import org.monetdb.util.XMLExporter; import java.io.BufferedReader; import java.io.BufferedWriter; +import java.io.Console; import java.io.IOException; import java.io.InputStreamReader; import java.io.File; @@ -257,7 +258,11 @@ public class JdbcClient { /* cannot (yet // we need the password from the user, fetch it with a pseudo // password protector if (pass == null) { - final char[] tmp = System.console().readPassword("password: "); + Console con = System.console(); + char[] tmp = null; + if (con != null) { + tmp = con.readPassword("password: "); + } if (tmp == null) { System.err.println("Invalid password!"); System.exit(1);