This is an automated email from the ASF dual-hosted git repository.
elecharny pushed a commit to branch 1.2.X
in repository https://gitbox.apache.org/repos/asf/mina-ftpserver.git
The following commit(s) were added to refs/heads/1.2.X by this push:
new cd828948 code formatting
cd828948 is described below
commit cd828948409920d87f0d66fa6d97f7cc13c57449
Author: emmanuel lecharny <[email protected]>
AuthorDate: Wed Jul 12 09:43:50 2023 +0200
code formatting
---
core/src/main/java/org/apache/ftpserver/main/AddUser.java | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/core/src/main/java/org/apache/ftpserver/main/AddUser.java
b/core/src/main/java/org/apache/ftpserver/main/AddUser.java
index 8dec68c3..a08d55d8 100644
--- a/core/src/main/java/org/apache/ftpserver/main/AddUser.java
+++ b/core/src/main/java/org/apache/ftpserver/main/AddUser.java
@@ -60,9 +60,9 @@ public class AddUser extends CommandLine {
AddUser addUser = new AddUser();
try {
-
// get configuration
FtpServer server = addUser.getConfiguration(args);
+
if (server == null) {
return;
}
@@ -77,6 +77,7 @@ public class AddUser extends CommandLine {
System.out.println();
String userName = askForString(in, "User name:", "User name is
mandatory");
+
if(userName == null) {
return;
}
@@ -85,13 +86,13 @@ public class AddUser extends CommandLine {
user.setPassword(askForString(in, "Password:"));
String home = askForString(in, "Home directory:", "Home directory
is mandatory");
+
if(home == null) {
- return;
+ return;
}
- user.setHomeDirectory(home);
+ user.setHomeDirectory(home);
user.setEnabled(askForBoolean(in, "Enabled (Y/N):"));
-
user.setMaxIdleTime(askForInt(in, "Max idle time in seconds (0 for
none):"));
List<Authority> authorities = new ArrayList<Authority>();
@@ -128,18 +129,20 @@ public class AddUser extends CommandLine {
} catch (Exception ex) {
ex.printStackTrace();
}
-
}
private static String askForString(BufferedReader in, String question)
throws IOException {
System.out.println(question);
+
return in.readLine();
}
private static String askForString(BufferedReader in, String question,
String mandatoryMessage) throws IOException {
String s = askForString(in, question);
+
if(isEmpty(s)) {
System.err.println(mandatoryMessage);
+
return null;
} else {
return s;