diff options
| author | Endi S. Dewata <edewata@redhat.com> | 2017-06-03 02:03:32 +0200 |
|---|---|---|
| committer | Endi S. Dewata <edewata@redhat.com> | 2017-06-03 03:09:01 +0200 |
| commit | 9741b7873005419b922ba79c61ef98ae17cb58be (patch) | |
| tree | da1286b15ff3ccb2de08fd9df01b61666c1ead7f /base/java-tools | |
| parent | af41896f083e1101b1ba62f6cc8c9be6064c6786 (diff) | |
| download | pki-9741b7873005419b922ba79c61ef98ae17cb58be.tar.gz pki-9741b7873005419b922ba79c61ef98ae17cb58be.tar.xz pki-9741b7873005419b922ba79c61ef98ae17cb58be.zip | |
Refactored MainCLI.loadPassword() (part 2).
The MainCLI.loadPassword() has been modified to fix the code
indentation.
https://pagure.io/dogtagpki/issue/2717
Change-Id: I7d208f1f4568f2fb1323ab206f45af5c0338b53f
Diffstat (limited to 'base/java-tools')
| -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(); |
