summaryrefslogtreecommitdiffstats
path: root/base/java-tools/src/com/netscape
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2017-03-18 07:45:30 +0100
committerEndi S. Dewata <edewata@redhat.com>2017-03-19 19:08:16 +0100
commit6bcb89b55db870766ddcf09002a5997b323bd196 (patch)
tree40df7bcbce814955c0627be17faf78b37f4cd6a1 /base/java-tools/src/com/netscape
parent2b9f9b7ef9e936dc5dc7ecc7bcc4c2fd8236dd1f (diff)
downloadpki-6bcb89b55db870766ddcf09002a5997b323bd196.tar.gz
pki-6bcb89b55db870766ddcf09002a5997b323bd196.tar.xz
pki-6bcb89b55db870766ddcf09002a5997b323bd196.zip
Fixed PKIClient initialization in PKI CLI.
The PKI CLI has been modified such that it initializes the PKIClient (and retrieves the access banner) only if the CLI needs to access the PKI server. https://pagure.io/dogtagpki/issue/2612
Diffstat (limited to 'base/java-tools/src/com/netscape')
-rw-r--r--base/java-tools/src/com/netscape/cmstools/cli/CLI.java2
-rw-r--r--base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java11
-rw-r--r--base/java-tools/src/com/netscape/cmstools/cli/ProxyCLI.java2
3 files changed, 13 insertions, 2 deletions
diff --git a/base/java-tools/src/com/netscape/cmstools/cli/CLI.java b/base/java-tools/src/com/netscape/cmstools/cli/CLI.java
index 0a9106705..65fad75e0 100644
--- a/base/java-tools/src/com/netscape/cmstools/cli/CLI.java
+++ b/base/java-tools/src/com/netscape/cmstools/cli/CLI.java
@@ -183,7 +183,7 @@ public class CLI {
return null;
}
- public PKIClient getClient() {
+ public PKIClient getClient() throws Exception {
return client;
}
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 4c0a91823..8f575dbf7 100644
--- a/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java
+++ b/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java
@@ -522,6 +522,15 @@ public class MainCLI extends CLI {
CryptoUtil.setSSLStreamVersionRange(SSLVersion.TLS_1_0, SSLVersion.TLS_1_2);
CryptoUtil.setSSLDatagramVersionRange(SSLVersion.TLS_1_1, SSLVersion.TLS_1_2);
CryptoUtil.setClientCiphers();
+ }
+
+ public PKIClient getClient() throws Exception {
+
+ if (client != null) return client;
+
+ if (verbose) {
+ System.out.println("Initializing PKIClient");
+ }
client = new PKIClient(config, null);
client.setVerbose(verbose);
@@ -558,6 +567,8 @@ public class MainCLI extends CLI {
}
}
}
+
+ return client;
}
public void execute(String[] args) throws Exception {
diff --git a/base/java-tools/src/com/netscape/cmstools/cli/ProxyCLI.java b/base/java-tools/src/com/netscape/cmstools/cli/ProxyCLI.java
index c5387cf03..1cf6feaf2 100644
--- a/base/java-tools/src/com/netscape/cmstools/cli/ProxyCLI.java
+++ b/base/java-tools/src/com/netscape/cmstools/cli/ProxyCLI.java
@@ -87,7 +87,7 @@ public class ProxyCLI extends CLI {
return module.removeModule(name);
}
- public PKIClient getClient() {
+ public PKIClient getClient() throws Exception {
return module.getClient();
}