I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 381f4947 authored by zzz's avatar zzz
Browse files

SU3File: Fix NPE on EOF reading input

parent 50641996
No related branches found
No related tags found
No related merge requests found
...@@ -619,7 +619,12 @@ public class SU3File { ...@@ -619,7 +619,12 @@ public class SU3File {
try { try {
while (keypw.length() < 6) { while (keypw.length() < 6) {
System.out.print("Enter password for key \"" + signerName + "\": "); System.out.print("Enter password for key \"" + signerName + "\": ");
keypw = DataHelper.readLine(System.in).trim(); keypw = DataHelper.readLine(System.in);
if (keypw == null) {
System.out.println("\nEOF reading password");
return false;
}
keypw = keypw.trim();
if (keypw.length() > 0 && keypw.length() < 6) if (keypw.length() > 0 && keypw.length() < 6)
System.out.println("Key password must be at least 6 characters"); System.out.println("Key password must be at least 6 characters");
} }
...@@ -690,7 +695,12 @@ public class SU3File { ...@@ -690,7 +695,12 @@ public class SU3File {
try { try {
while (keypw.length() < 6) { while (keypw.length() < 6) {
System.out.print("Enter password for key \"" + signerName + "\": "); System.out.print("Enter password for key \"" + signerName + "\": ");
keypw = DataHelper.readLine(System.in).trim(); keypw = DataHelper.readLine(System.in);
if (keypw == null) {
System.out.println("\nEOF reading password");
return false;
}
keypw = keypw.trim();
if (keypw.length() > 0 && keypw.length() < 6) if (keypw.length() > 0 && keypw.length() < 6)
System.out.println("Key password must be at least 6 characters"); System.out.println("Key password must be at least 6 characters");
} }
...@@ -784,11 +794,21 @@ public class SU3File { ...@@ -784,11 +794,21 @@ public class SU3File {
try { try {
while (alias.length() == 0) { while (alias.length() == 0) {
System.out.print("Enter key name (example@mail.i2p): "); System.out.print("Enter key name (example@mail.i2p): ");
alias = DataHelper.readLine(System.in).trim(); alias = DataHelper.readLine(System.in);
if (alias == null) {
System.out.println("\nEOF reading key name");
return false;
}
alias = alias.trim();
} }
while (keypw.length() < 6) { while (keypw.length() < 6) {
System.out.print("Enter new key password: "); System.out.print("Enter new key password: ");
keypw = DataHelper.readLine(System.in).trim(); keypw = DataHelper.readLine(System.in);
if (keypw == null) {
System.out.println("\nEOF reading password");
return false;
}
keypw = keypw.trim();
if (keypw.length() > 0 && keypw.length() < 6) if (keypw.length() > 0 && keypw.length() < 6)
System.out.println("Key password must be at least 6 characters"); System.out.println("Key password must be at least 6 characters");
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment