Changeset: 30a1e540721f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=30a1e540721f
Modified Files:
java/src/nl/cwi/monetdb/client/JMonetDB.java
Branch: Apr2012
Log Message:
JmonetDB: use cleaner password reading method like JdbcClient
in addition, return 1 on failures like JdbcClient
diffs (49 lines):
diff --git a/java/src/nl/cwi/monetdb/client/JMonetDB.java
b/java/src/nl/cwi/monetdb/client/JMonetDB.java
--- a/java/src/nl/cwi/monetdb/client/JMonetDB.java
+++ b/java/src/nl/cwi/monetdb/client/JMonetDB.java
@@ -67,7 +67,7 @@ public class JMonetDB {
copts.processArgs(args);
} catch (OptionsException e) {
System.err.println("Error: " + e.getMessage());
- System.exit(-1);
+ System.exit(1);
}
if (copts.getOption("help").isPresent()) {
@@ -92,14 +92,12 @@ copts.produceHelpMessage()
// we need the password from the user, fetch it with a pseudo
// password protector
if (pass == null) {
- try {
- char[] tmp =
PasswordField.getPassword(System.in, "passhrase: ");
- if (tmp != null) pass = String.valueOf(tmp);
- } catch (IOException ioe) {
+ char[] tmp = System.console().readPassword("passphrase:
");
+ if (tmp == null) {
System.err.println("Invalid passphrase!");
- System.exit(-1);
+ System.exit(1);
}
- System.out.println("");
+ pass = String.valueOf(tmp);
}
// build the hostname
@@ -118,7 +116,7 @@ copts.produceHelpMessage()
if (!copts.getOption("command").isPresent()) {
System.err.println("need a command to execute (-c)");
- System.exit(-1);
+ System.exit(1);
}
Control ctl = null;
@@ -126,7 +124,7 @@ copts.produceHelpMessage()
ctl = new Control(host, port, pass);
} catch (IllegalArgumentException e) {
System.err.println(e.getMessage());
- System.exit(-1);
+ System.exit(1);
}
// FIXME: Control needs to respect Xhash
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list