neurolabs / henplus

HenPlus is a SQL shell that can handle multiple sessions in parallel. The commandline interface with the usual history functions features TAB-completion for commands, tables and columns. Database connect via JDBC.
GNU General Public License v2.0
97 stars 51 forks source link

Since Java 6 there is first-class support for reading passwords on the command line #47

Open ShulluTech opened 5 years ago

ShulluTech commented 5 years ago

Remove password kludge with Java 6's Console's readPassword method.

Example from the API Javadoc:

 Console cons;
 char[] passwd;
 if ((cons = System.console()) != null &&
     (passwd = cons.readPassword("[%s]", "Password:")) != null) {
     ...
     java.util.Arrays.fill(passwd, ' ');
 }