diff options
Diffstat (limited to 'base/java-tools/src/com')
| -rw-r--r-- | base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java b/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java index 2402196e0..2b6b173b8 100644 --- a/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java +++ b/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java @@ -247,35 +247,36 @@ public class MainCLI extends CLI { throw new Exception("File '" + pwfile + "' does not define a token or a password!"); } - if (line.contains(delimiter)) { - // Process 'token=password' format: - // - // Token: tokenPassword[0] - // Password: tokenPassword[1] - // - tokenPassword = line.split(delimiter, 2); - - // Always trim leading/trailing whitespace from 'token' - tokenPassword[0] = tokenPassword[0].trim(); - - // Check for undefined 'token' - if (tokenPassword[0].isEmpty()) { - // Set default 'token' - tokenPassword[0] = CryptoUtil.INTERNAL_TOKEN_NAME; - } - - // Check for undefined 'password' - if (tokenPassword[1].isEmpty()) { - throw new Exception("File '" + pwfile + "' does not define a password!"); - } - } else { + if (line.contains(delimiter)) { + // Process 'token=password' format: + // + // Token: tokenPassword[0] + // Password: tokenPassword[1] + // + tokenPassword = line.split(delimiter, 2); + + // Always trim leading/trailing whitespace from 'token' + tokenPassword[0] = tokenPassword[0].trim(); + + // Check for undefined 'token' + if (tokenPassword[0].isEmpty()) { // Set default 'token' tokenPassword[0] = CryptoUtil.INTERNAL_TOKEN_NAME; + } - // Set simple 'password' (do not trim leading/trailing whitespace) - tokenPassword[1] = line; + // Check for undefined 'password' + if (tokenPassword[1].isEmpty()) { + throw new Exception("File '" + pwfile + "' does not define a password!"); } + } else { + // Set default 'token' + tokenPassword[0] = CryptoUtil.INTERNAL_TOKEN_NAME; + + // Set simple 'password' (do not trim leading/trailing whitespace) + tokenPassword[1] = line; + } + } finally { if (br != null) { br.close(); |
