diff options
author | Adam Young <ayoung@redhat.com> | 2011-12-05 17:42:21 -0500 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2011-12-05 20:14:07 -0500 |
commit | 3c1a4af339dc1761b3a68abe9b0f26bd3cb389cf (patch) | |
tree | 0dc5335d8b0e21c2801ac04cf3470e1efbcff92a /pki/base | |
parent | 8bcaa20e72e97b9392cc65bd3428a93170720b77 (diff) | |
download | pki-3c1a4af339dc1761b3a68abe9b0f26bd3cb389cf.tar.gz pki-3c1a4af339dc1761b3a68abe9b0f26bd3cb389cf.tar.xz pki-3c1a4af339dc1761b3a68abe9b0f26bd3cb389cf.zip |
PKISilent type safety changes
Specifies the types for the collections.
Changes no behavior, and, due to erasure, should not even change the resulting byte code.
Diffstat (limited to 'pki/base')
19 files changed, 214 insertions, 232 deletions
diff --git a/pki/base/silent/src/com/netscape/pkisilent/ConfigureCA.java b/pki/base/silent/src/com/netscape/pkisilent/ConfigureCA.java index b31f47d40..0a1c16660 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/ConfigureCA.java +++ b/pki/base/silent/src/com/netscape/pkisilent/ConfigureCA.java @@ -28,7 +28,6 @@ import java.io.InputStreamReader; import java.io.PrintStream; import java.net.URLEncoder; import java.util.ArrayList; -import java.util.Hashtable; import org.mozilla.jss.asn1.SEQUENCE; import org.mozilla.jss.pkcs12.AuthenticatedSafes; @@ -45,7 +44,6 @@ import com.netscape.pkisilent.http.HTTPResponse; public class ConfigureCA { - public static Hashtable mUsedPort = new Hashtable(); // global constants public static final String DEFAULT_KEY_TYPE = "RSA"; @@ -520,7 +518,7 @@ public class ConfigureCA { HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList al = null; + ArrayList<String> al = null; String query_string = null; if (clone) { query_string = "p=10" + "&op=next" + "&xml=true" @@ -572,11 +570,11 @@ public class ConfigureCA { bais = new ByteArrayInputStream(hr.getHTML().getBytes()); px.parse(bais); - al = px.constructvaluelist("CertReqPair", "DN"); + al = px.constructValueList("CertReqPair", "DN"); // get ca cert subject name if (al != null) { for (int i = 0; i < al.size(); i++) { - String temp = (String) al.get(i); + String temp = al.get(i); if (temp.indexOf("Certificate Authority") > 0) { ca_cert_name = temp; @@ -613,9 +611,9 @@ public class ConfigureCA { HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList req_list = null; - ArrayList cert_list = null; - ArrayList dn_list = null; + ArrayList<String> req_list = null; + ArrayList<String> cert_list = null; + ArrayList<String> dn_list = null; String query_string = null; // use subject names provided as input @@ -643,9 +641,9 @@ public class ConfigureCA { bais = new ByteArrayInputStream(hr.getHTML().getBytes()); px.parse(bais); - req_list = px.constructvaluelist("CertReqPair", "Request"); - cert_list = px.constructvaluelist("CertReqPair", "Certificate"); - dn_list = px.constructvaluelist("CertReqPair", "Nickname"); + req_list = px.constructValueList("CertReqPair", "Request"); + cert_list = px.constructValueList("CertReqPair", "Certificate"); + dn_list = px.constructValueList("CertReqPair", "Nickname"); System.out.println("req_list_size=" + req_list.size()); System.out.println("cert_list_size=" + cert_list.size()); @@ -654,9 +652,9 @@ public class ConfigureCA { if (external_ca.equalsIgnoreCase("true")) { if ((req_list != null) && (dn_list != null)) { for (int i = 0; i < dn_list.size(); i++) { - String temp = (String) dn_list.get(i); + String temp = dn_list.get(i); if (temp.indexOf("caSigningCert") >= 0) { - ca_cert_req = (String) req_list.get(i); + ca_cert_req = req_list.get(i); } } } @@ -703,23 +701,23 @@ public class ConfigureCA { if (req_list != null && cert_list != null && dn_list != null) { for (int i = 0; i < dn_list.size(); i++) { - String temp = (String) dn_list.get(i); + String temp = dn_list.get(i); if (temp.indexOf("caSigningCert") >= 0) { - ca_cert_req = (String) req_list.get(i); - ca_cert_cert = (String) cert_list.get(i); + ca_cert_req = req_list.get(i); + ca_cert_cert = cert_list.get(i); } else if (temp.indexOf("ocspSigningCert") >= 0) { - ocsp_cert_req = (String) req_list.get(i); - ocsp_cert_cert = (String) cert_list.get(i); + ocsp_cert_req = req_list.get(i); + ocsp_cert_cert = cert_list.get(i); } else if (temp.indexOf("subsystemCert") >= 0) { - ca_subsystem_cert_req = (String) req_list.get(i); - ca_subsystem_cert_cert = (String) cert_list.get(i); + ca_subsystem_cert_req = req_list.get(i); + ca_subsystem_cert_cert = cert_list.get(i); } else if (temp.indexOf("auditSigningCert") >=0) { - ca_audit_signing_cert_req = (String) req_list.get(i); - ca_audit_signing_cert_cert = (String) cert_list.get(i); + ca_audit_signing_cert_req = req_list.get(i); + ca_audit_signing_cert_cert = cert_list.get(i); } else { - server_cert_req = (String) req_list.get(i); - server_cert_cert = (String) cert_list.get(i); + server_cert_req = req_list.get(i); + server_cert_cert = cert_list.get(i); } } } @@ -790,10 +788,10 @@ public class ConfigureCA { HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList req_list = null; - ArrayList cert_list = null; - ArrayList dn_list = null; - ArrayList pp_list = null; + ArrayList<String> req_list = null; + ArrayList<String> cert_list = null; + ArrayList<String> dn_list = null; + ArrayList<String> pp_list = null; String genString = "...certificate be generated internally..."; String query_string = "p=12" + "&op=apply" + "&xml=true" + "&subsystem=" @@ -816,9 +814,9 @@ public class ConfigureCA { bais = new ByteArrayInputStream(hr.getHTML().getBytes()); px.parse(bais); - req_list = px.constructvaluelist("CertReqPair", "Request"); - cert_list = px.constructvaluelist("CertReqPair", "Certificate"); - dn_list = px.constructvaluelist("CertReqPair", "Nickname"); + req_list = px.constructValueList("CertReqPair", "Request"); + cert_list = px.constructValueList("CertReqPair", "Certificate"); + dn_list = px.constructValueList("CertReqPair", "Nickname"); System.out.println("req_list_size=" + req_list.size()); System.out.println("cert_list_size=" + cert_list.size()); @@ -826,23 +824,23 @@ public class ConfigureCA { if (req_list != null && cert_list != null && dn_list != null) { for (int i = 0; i < dn_list.size(); i++) { - String temp = (String) dn_list.get(i); + String temp = dn_list.get(i); if (temp.indexOf("caSigningCert") >= 0) { - ca_cert_req = (String) req_list.get(i); - ca_cert_cert = (String) cert_list.get(i); + ca_cert_req = req_list.get(i); + ca_cert_cert = cert_list.get(i); } else if (temp.indexOf("ocspSigningCert") >= 0) { - ocsp_cert_req = (String) req_list.get(i); - ocsp_cert_cert = (String) cert_list.get(i); + ocsp_cert_req = req_list.get(i); + ocsp_cert_cert = cert_list.get(i); } else if (temp.indexOf("subsystemCert") >= 0) { - ca_subsystem_cert_req = (String) req_list.get(i); - ca_subsystem_cert_cert = (String) cert_list.get(i); + ca_subsystem_cert_req = req_list.get(i); + ca_subsystem_cert_cert = cert_list.get(i); } else if (temp.indexOf("auditSigningCert") >= 0) { - ca_audit_signing_cert_req = (String) req_list.get(i); - ca_audit_signing_cert_cert = (String) cert_list.get(i); + ca_audit_signing_cert_req = req_list.get(i); + ca_audit_signing_cert_cert = cert_list.get(i); } else { - server_cert_req = (String) req_list.get(i); - server_cert_cert = (String) cert_list.get(i); + server_cert_req = req_list.get(i); + server_cert_cert = cert_list.get(i); } } } diff --git a/pki/base/silent/src/com/netscape/pkisilent/ConfigureDRM.java b/pki/base/silent/src/com/netscape/pkisilent/ConfigureDRM.java index 17a0042c0..29e3cf19c 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/ConfigureDRM.java +++ b/pki/base/silent/src/com/netscape/pkisilent/ConfigureDRM.java @@ -26,7 +26,6 @@ import java.io.FileOutputStream; import java.io.InputStreamReader; import java.net.URLEncoder; import java.util.ArrayList; -import java.util.Hashtable; import org.mozilla.jss.asn1.SEQUENCE; import org.mozilla.jss.pkcs12.AuthenticatedSafes; @@ -43,8 +42,6 @@ import com.netscape.pkisilent.http.HTTPResponse; public class ConfigureDRM { - public static Hashtable mUsedPort = new Hashtable(); - // global constants public static final String DEFAULT_KEY_TYPE = "RSA"; public static final String DEFAULT_KEY_SIZE = "2048"; @@ -476,7 +473,7 @@ public class ConfigureDRM HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList al = null; + ArrayList<String> al = null; String query_string = null; @@ -526,11 +523,11 @@ public class ConfigureDRM px.parse(bais); px.prettyprintxml(); - al = px.constructvaluelist("CertReqPair","DN"); + al = px.constructValueList("CertReqPair","DN"); // get ca cert subject name if (al != null) { for (int i=0; i < al.size(); i++) { - String temp = (String) al.get(i); + String temp = al.get(i); if (temp.indexOf("DRM Transport") > 0) { drm_transport_cert_name = temp; } else if (temp.indexOf("DRM Storage") > 0) { @@ -565,9 +562,9 @@ public class ConfigureDRM HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList req_list = null; - ArrayList cert_list = null; - ArrayList dn_list = null; + ArrayList<String> req_list = null; + ArrayList<String> cert_list = null; + ArrayList<String> dn_list = null; String query_string = null; String domain_url = "https://" + ca_hostname + ":" + ca_ssl_port ; @@ -601,29 +598,29 @@ public class ConfigureDRM px.parse(bais); px.prettyprintxml(); - req_list = px.constructvaluelist("CertReqPair","Request"); - cert_list = px.constructvaluelist("CertReqPair","Certificate"); - dn_list = px.constructvaluelist("CertReqPair","Nickname"); + req_list = px.constructValueList("CertReqPair","Request"); + cert_list = px.constructValueList("CertReqPair","Certificate"); + dn_list = px.constructValueList("CertReqPair","Nickname"); if (req_list != null && cert_list != null && dn_list != null) { for (int i=0; i < dn_list.size(); i++) { - String temp = (String) dn_list.get(i); + String temp = dn_list.get(i); if (temp.indexOf("transportCert") >= 0) { - drm_transport_cert_req = (String) req_list.get(i); - drm_transport_cert_cert = (String) cert_list.get(i); + drm_transport_cert_req = req_list.get(i); + drm_transport_cert_cert = cert_list.get(i); } else if (temp.indexOf("storageCert") >= 0) { - drm_storage_cert_req = (String) req_list.get(i); - drm_storage_cert_cert = (String) cert_list.get(i); + drm_storage_cert_req = req_list.get(i); + drm_storage_cert_cert = cert_list.get(i); } else if (temp.indexOf("subsystemCert") >= 0) { - drm_subsystem_cert_req = (String) req_list.get(i); - drm_subsystem_cert_cert = (String) cert_list.get(i); + drm_subsystem_cert_req = req_list.get(i); + drm_subsystem_cert_cert = cert_list.get(i); } else if (temp.indexOf("auditSigningCert") >=0) { - drm_audit_signing_cert_req = (String) req_list.get(i); - drm_audit_signing_cert_cert = (String) cert_list.get(i); + drm_audit_signing_cert_req = req_list.get(i); + drm_audit_signing_cert_cert = cert_list.get(i); } else { - server_cert_req = (String) req_list.get(i); - server_cert_cert = (String) cert_list.get(i); + server_cert_req = req_list.get(i); + server_cert_cert = cert_list.get(i); } } } @@ -637,10 +634,10 @@ public class ConfigureDRM HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList req_list = null; - ArrayList cert_list = null; - ArrayList dn_list = null; - ArrayList pp_list = null; + ArrayList<String> req_list = null; + ArrayList<String> cert_list = null; + ArrayList<String> dn_list = null; + ArrayList<String> pp_list = null; String query_string = "p=10" + "&op=next" + "&xml=true" + diff --git a/pki/base/silent/src/com/netscape/pkisilent/ConfigureOCSP.java b/pki/base/silent/src/com/netscape/pkisilent/ConfigureOCSP.java index 1c775d814..55f008181 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/ConfigureOCSP.java +++ b/pki/base/silent/src/com/netscape/pkisilent/ConfigureOCSP.java @@ -25,7 +25,6 @@ import java.io.FileOutputStream; import java.io.InputStreamReader; import java.net.URLEncoder; import java.util.ArrayList; -import java.util.Hashtable; import org.mozilla.jss.asn1.SEQUENCE; import org.mozilla.jss.pkcs12.AuthenticatedSafes; @@ -41,8 +40,6 @@ import com.netscape.pkisilent.http.HTTPResponse; public class ConfigureOCSP { - public static Hashtable mUsedPort = new Hashtable(); - public static final String DEFAULT_KEY_TYPE = "RSA"; public static final String DEFAULT_KEY_SIZE = "2048"; public static final String DEFAULT_KEY_CURVENAME = "nistp256"; @@ -419,7 +416,7 @@ public class ConfigureOCSP HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList al = null; + ArrayList<String> al = null; String query_string = "p=8" + "&op=next" + "&xml=true" + "&signing_custom_size=" + signing_key_size + @@ -452,11 +449,11 @@ public class ConfigureOCSP px.parse(bais); px.prettyprintxml(); - al = px.constructvaluelist("CertReqPair","DN"); + al = px.constructValueList("CertReqPair","DN"); // get ca cert subject name if (al != null) { for (int i=0; i < al.size(); i++) { - String temp = (String) al.get(i); + String temp = al.get(i); if (temp.indexOf("OCSP Signing") > 0) { ocsp_signing_cert_name = temp; } else if (temp.indexOf("OCSP Subsystem") > 0) { @@ -483,9 +480,9 @@ public class ConfigureOCSP HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList req_list = null; - ArrayList cert_list = null; - ArrayList dn_list = null; + ArrayList<String> req_list = null; + ArrayList<String> cert_list = null; + ArrayList<String> dn_list = null; String domain_url = "https://" + ca_hostname + ":" + ca_ssl_port ; @@ -509,26 +506,26 @@ public class ConfigureOCSP px.parse(bais); px.prettyprintxml(); - req_list = px.constructvaluelist("CertReqPair","Request"); - cert_list = px.constructvaluelist("CertReqPair","Certificate"); - dn_list = px.constructvaluelist("CertReqPair","Nickname"); + req_list = px.constructValueList("CertReqPair","Request"); + cert_list = px.constructValueList("CertReqPair","Certificate"); + dn_list = px.constructValueList("CertReqPair","Nickname"); if (req_list != null && cert_list != null && dn_list != null) { for (int i=0; i < dn_list.size(); i++) { - String temp = (String) dn_list.get(i); + String temp = dn_list.get(i); if (temp.indexOf("ocspSigningCert") >= 0 ) { - ocsp_signing_cert_req = (String) req_list.get(i); - ocsp_signing_cert_cert = (String) cert_list.get(i); + ocsp_signing_cert_req = req_list.get(i); + ocsp_signing_cert_cert = cert_list.get(i); } else if (temp.indexOf("subsystemCert") >= 0 ) { - ocsp_subsystem_cert_req = (String) req_list.get(i); - ocsp_subsystem_cert_cert = (String) cert_list.get(i); + ocsp_subsystem_cert_req = req_list.get(i); + ocsp_subsystem_cert_cert = cert_list.get(i); } else if (temp.indexOf("auditSigningCert") >=0) { - ocsp_audit_signing_cert_req = (String) req_list.get(i); - ocsp_audit_signing_cert_cert = (String) cert_list.get(i); + ocsp_audit_signing_cert_req = req_list.get(i); + ocsp_audit_signing_cert_cert = cert_list.get(i); } else { - server_cert_req = (String) req_list.get(i); - server_cert_cert = (String) cert_list.get(i); + server_cert_req = req_list.get(i); + server_cert_cert = cert_list.get(i); } } } @@ -542,10 +539,10 @@ public class ConfigureOCSP HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList req_list = null; - ArrayList cert_list = null; - ArrayList dn_list = null; - ArrayList pp_list = null; + ArrayList<String> req_list = null; + ArrayList<String> cert_list = null; + ArrayList<String> dn_list = null; + ArrayList<String> pp_list = null; String query_string = "p=10" + "&op=next" + "&xml=true" + diff --git a/pki/base/silent/src/com/netscape/pkisilent/ConfigureRA.java b/pki/base/silent/src/com/netscape/pkisilent/ConfigureRA.java index d8a8b0248..6bb7cd2c9 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/ConfigureRA.java +++ b/pki/base/silent/src/com/netscape/pkisilent/ConfigureRA.java @@ -20,7 +20,6 @@ package com.netscape.pkisilent; import java.io.ByteArrayInputStream; import java.net.URLEncoder; import java.util.ArrayList; -import java.util.Hashtable; import com.netscape.osutil.OSUtil; import com.netscape.pkisilent.argparser.ArgParser; @@ -33,7 +32,6 @@ import com.netscape.pkisilent.http.HTTPResponse; public class ConfigureRA { - public static Hashtable mUsedPort = new Hashtable(); // define global variables @@ -421,9 +419,9 @@ public class ConfigureRA HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList req_list = null; - ArrayList cert_list = null; - ArrayList dn_list = null; + ArrayList<String> req_list = null; + ArrayList<String> cert_list = null; + ArrayList<String> dn_list = null; String ca_url = "https://" + ca_hostname + ":" + ca_ssl_port ; diff --git a/pki/base/silent/src/com/netscape/pkisilent/ConfigureSubCA.java b/pki/base/silent/src/com/netscape/pkisilent/ConfigureSubCA.java index 715cc2306..d492d5fcb 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/ConfigureSubCA.java +++ b/pki/base/silent/src/com/netscape/pkisilent/ConfigureSubCA.java @@ -20,7 +20,6 @@ package com.netscape.pkisilent; import java.io.ByteArrayInputStream; import java.net.URLEncoder; import java.util.ArrayList; -import java.util.Hashtable; import com.netscape.osutil.OSUtil; import com.netscape.pkisilent.argparser.ArgParser; @@ -33,8 +32,6 @@ import com.netscape.pkisilent.http.HTTPResponse; public class ConfigureSubCA { - public static Hashtable mUsedPort = new Hashtable(); - // global constants public static final String DEFAULT_KEY_TYPE = "RSA"; public static final String DEFAULT_KEY_SIZE = "2048"; @@ -439,7 +436,7 @@ public class ConfigureSubCA HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList al = null; + ArrayList<String> al = null; String query_string = "p=10" + "&op=next" + "&xml=true" + "&subsystem_custom_size=" + subsystem_key_size @@ -479,11 +476,11 @@ public class ConfigureSubCA px.parse(bais); px.prettyprintxml(); - al = px.constructvaluelist("CertReqPair","DN"); + al = px.constructValueList("CertReqPair","DN"); // get ca cert subject name if (al != null) { for (int i=0; i < al.size(); i++) { - String temp = (String) al.get(i); + String temp = al.get(i); if (temp.indexOf("Certificate Authority") > 0 ) { ca_cert_name = temp; } else if (temp.indexOf("OCSP Signing Certificate") > 0 ) { @@ -514,9 +511,9 @@ public class ConfigureSubCA HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList req_list = null; - ArrayList cert_list = null; - ArrayList dn_list = null; + ArrayList<String> req_list = null; + ArrayList<String> cert_list = null; + ArrayList<String> dn_list = null; String domain_url = "https://" + ca_hostname + ":" + ca_ssl_port ; @@ -542,9 +539,9 @@ public class ConfigureSubCA px.parse(bais); px.prettyprintxml(); - req_list = px.constructvaluelist("CertReqPair","Request"); - cert_list = px.constructvaluelist("CertReqPair","Certificate"); - dn_list = px.constructvaluelist("CertReqPair","Nickname"); + req_list = px.constructValueList("CertReqPair","Request"); + cert_list = px.constructValueList("CertReqPair","Certificate"); + dn_list = px.constructValueList("CertReqPair","Nickname"); System.out.println("req_list_size=" + req_list.size()); System.out.println("cert_list_size=" + cert_list.size()); @@ -552,23 +549,23 @@ public class ConfigureSubCA if (req_list != null && cert_list != null && dn_list != null) { for (int i=0; i < dn_list.size(); i++) { - String temp = (String) dn_list.get(i); + String temp = dn_list.get(i); if (temp.indexOf("caSigningCert") >= 0 ) { - ca_cert_req = (String) req_list.get(i); - ca_cert_cert = (String) cert_list.get(i); + ca_cert_req = req_list.get(i); + ca_cert_cert = cert_list.get(i); } else if (temp.indexOf("ocspSigningCert") >= 0 ) { - ocsp_cert_req = (String) req_list.get(i); - ocsp_cert_cert = (String) cert_list.get(i); + ocsp_cert_req = req_list.get(i); + ocsp_cert_cert = cert_list.get(i); } else if (temp.indexOf("subsystemCert") >= 0 ) { - ca_subsystem_cert_req = (String) req_list.get(i); - ca_subsystem_cert_cert = (String) cert_list.get(i); + ca_subsystem_cert_req = req_list.get(i); + ca_subsystem_cert_cert = cert_list.get(i); } else if (temp.indexOf("auditSigningCert") >=0) { - ca_audit_signing_cert_req = (String) req_list.get(i); - ca_audit_signing_cert_cert = (String) cert_list.get(i); + ca_audit_signing_cert_req = req_list.get(i); + ca_audit_signing_cert_cert = cert_list.get(i); } else { - server_cert_req = (String) req_list.get(i); - server_cert_cert = (String) cert_list.get(i); + server_cert_req = req_list.get(i); + server_cert_cert = cert_list.get(i); } } } @@ -605,10 +602,10 @@ public class ConfigureSubCA HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList req_list = null; - ArrayList cert_list = null; - ArrayList dn_list = null; - ArrayList pp_list = null; + ArrayList<String> req_list = null; + ArrayList<String> cert_list = null; + ArrayList<String> dn_list = null; + ArrayList<String> pp_list = null; String query_string = "p=12" + "&op=next" + "&xml=true" + diff --git a/pki/base/silent/src/com/netscape/pkisilent/ConfigureTKS.java b/pki/base/silent/src/com/netscape/pkisilent/ConfigureTKS.java index 7d75fe56a..b681b84c7 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/ConfigureTKS.java +++ b/pki/base/silent/src/com/netscape/pkisilent/ConfigureTKS.java @@ -25,7 +25,6 @@ import java.io.FileOutputStream; import java.io.InputStreamReader; import java.net.URLEncoder; import java.util.ArrayList; -import java.util.Hashtable; import org.mozilla.jss.asn1.SEQUENCE; import org.mozilla.jss.pkcs12.AuthenticatedSafes; @@ -42,8 +41,6 @@ import com.netscape.pkisilent.http.HTTPResponse; public class ConfigureTKS { - public static Hashtable mUsedPort = new Hashtable(); - public static final String DEFAULT_KEY_TYPE = "RSA"; public static final String DEFAULT_KEY_SIZE = "2048"; public static final String DEFAULT_KEY_CURVENAME = "nistp256"; @@ -402,7 +399,7 @@ public class ConfigureTKS HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList al = null; + ArrayList<String> al = null; String query_string = "p=8" + "&op=next" + "&xml=true" + @@ -430,11 +427,11 @@ public class ConfigureTKS px.parse(bais); px.prettyprintxml(); - al = px.constructvaluelist("CertReqPair","DN"); + al = px.constructValueList("CertReqPair","DN"); // get ca cert subject name if (al != null) { for (int i=0; i < al.size(); i++) { - String temp = (String) al.get(i); + String temp = al.get(i); if (temp.indexOf("TKS Subsystem") > 0 ) { tks_subsystem_cert_name = temp; } else if (temp.indexOf("Audit Signing Certificate") > 0) { @@ -459,9 +456,9 @@ public class ConfigureTKS HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList req_list = null; - ArrayList cert_list = null; - ArrayList dn_list = null; + ArrayList<String> req_list = null; + ArrayList<String> cert_list = null; + ArrayList<String> dn_list = null; String domain_url = "https://" + ca_hostname + ":" + ca_ssl_port ; @@ -483,23 +480,23 @@ public class ConfigureTKS px.parse(bais); px.prettyprintxml(); - req_list = px.constructvaluelist("CertReqPair","Request"); - cert_list = px.constructvaluelist("CertReqPair","Certificate"); - dn_list = px.constructvaluelist("CertReqPair","Nickname"); + req_list = px.constructValueList("CertReqPair","Request"); + cert_list = px.constructValueList("CertReqPair","Certificate"); + dn_list = px.constructValueList("CertReqPair","Nickname"); if (req_list != null && cert_list != null && dn_list != null) { for (int i=0; i < dn_list.size(); i++) { - String temp = (String) dn_list.get(i); + String temp = dn_list.get(i); if (temp.indexOf("subsystemCert") >= 0 ) { - tks_subsystem_cert_req = (String) req_list.get(i); - tks_subsystem_cert_cert = (String) cert_list.get(i); + tks_subsystem_cert_req = req_list.get(i); + tks_subsystem_cert_cert = cert_list.get(i); } else if (temp.indexOf("auditSigningCert") >=0) { - tks_audit_signing_cert_req = (String) req_list.get(i); - tks_audit_signing_cert_cert = (String) cert_list.get(i); + tks_audit_signing_cert_req = req_list.get(i); + tks_audit_signing_cert_cert = cert_list.get(i); } else { - server_cert_req = (String) req_list.get(i); - server_cert_cert = (String) cert_list.get(i); + server_cert_req = req_list.get(i); + server_cert_cert = cert_list.get(i); } } } @@ -513,10 +510,10 @@ public class ConfigureTKS HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList req_list = null; - ArrayList cert_list = null; - ArrayList dn_list = null; - ArrayList pp_list = null; + ArrayList<String> req_list = null; + ArrayList<String> cert_list = null; + ArrayList<String> dn_list = null; + ArrayList<String> pp_list = null; String query_string = "p=10" + "&op=next" + "&xml=true" + diff --git a/pki/base/silent/src/com/netscape/pkisilent/ConfigureTPS.java b/pki/base/silent/src/com/netscape/pkisilent/ConfigureTPS.java index 71ae942f6..fde32131c 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/ConfigureTPS.java +++ b/pki/base/silent/src/com/netscape/pkisilent/ConfigureTPS.java @@ -20,7 +20,6 @@ package com.netscape.pkisilent; import java.io.ByteArrayInputStream; import java.net.URLEncoder; import java.util.ArrayList; -import java.util.Hashtable; import com.netscape.osutil.OSUtil; import com.netscape.pkisilent.argparser.ArgParser; @@ -32,9 +31,6 @@ import com.netscape.pkisilent.http.HTTPResponse; public class ConfigureTPS { - - public static Hashtable mUsedPort = new Hashtable(); - // define global variables public static HTTPClient hc = null; @@ -505,8 +501,8 @@ public class ConfigureTPS HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList friendly_list = null; - ArrayList dn_list = null; + ArrayList<String> friendly_list = null; + ArrayList<String> dn_list = null; String query_string = "p=11" + @@ -541,10 +537,10 @@ public class ConfigureTPS HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList req_list = null; - ArrayList cert_list = null; - ArrayList dn_list = null; - ArrayList friendly_list = null; + ArrayList<String> req_list = null; + ArrayList<String> cert_list = null; + ArrayList<String> dn_list = null; + ArrayList<String> friendly_list = null; String ca_url = "https://" + ca_hostname + ":" + ca_ssl_port ; @@ -583,10 +579,10 @@ public class ConfigureTPS HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList req_list = null; - ArrayList cert_list = null; - ArrayList dn_list = null; - ArrayList pp_list = null; + ArrayList<String> req_list = null; + ArrayList<String> cert_list = null; + ArrayList<String> dn_list = null; + ArrayList<String> pp_list = null; String query_string = "p=13" + diff --git a/pki/base/silent/src/com/netscape/pkisilent/PKISilent.java b/pki/base/silent/src/com/netscape/pkisilent/PKISilent.java index 97d097c51..e61af61f0 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/PKISilent.java +++ b/pki/base/silent/src/com/netscape/pkisilent/PKISilent.java @@ -9,7 +9,7 @@ public class PKISilent { private static void usage() { System.out.print("usage: java " + PKISilent.class.getCanonicalName()); boolean first = true; - for (Class c : classes) { + for (Class<?> c : classes) { if (first) { System.out.println(" [ "); } else { @@ -21,13 +21,13 @@ public class PKISilent { System.out.println(" ] "); } - static Class[] classes = { ConfigureCA.class, ConfigureDRM.class, + static Class<?>[] classes = { ConfigureCA.class, ConfigureDRM.class, ConfigureOCSP.class, ConfigureRA.class, ConfigureSubCA.class, ConfigureTKS.class, ConfigureTPS.class, CreateInstance.class, }; public static final void main(String[] args) { HashMap<String, Method> classMap = new HashMap<String, Method>(); - for (Class c : classes) { + for (Class<?> c : classes) { try { classMap.put(c.getSimpleName(), c.getMethod("main", String[].class)); diff --git a/pki/base/silent/src/com/netscape/pkisilent/argparser/ArgParser.java b/pki/base/silent/src/com/netscape/pkisilent/argparser/ArgParser.java index 29033d6b7..a205d1012 100755 --- a/pki/base/silent/src/com/netscape/pkisilent/argparser/ArgParser.java +++ b/pki/base/silent/src/com/netscape/pkisilent/argparser/ArgParser.java @@ -397,7 +397,7 @@ import java.util.Vector; */ public class ArgParser { - Vector matchList; + Vector<Record> matchList; // int tabSpacing = 8; String synopsisString; boolean helpOptionsEnabled = true; @@ -997,11 +997,11 @@ public class ArgParser */ public ArgParser(String synopsisString, boolean defaultHelp) { - matchList = new Vector(128); + matchList = new Vector<Record>(128); this.synopsisString = synopsisString; if (defaultHelp) { addOption ("-help,-? %h #displays help information", null); - defaultHelpOption = firstHelpOption = (Record)matchList.get(0); + defaultHelpOption = firstHelpOption = matchList.get(0); } } @@ -1826,7 +1826,7 @@ public class ArgParser return null; // can't happen } - static void stringToArgs (Vector vec, String s, + static void stringToArgs (Vector<String> vec, String s, boolean allowQuotedStrings) throws StringScanException { @@ -1862,7 +1862,7 @@ public class ArgParser { args = new String[0]; } LineNumberReader lineReader = new LineNumberReader (reader); - Vector vec = new Vector(100, 100); + Vector<String> vec = new Vector<String>(100, 100); String line; int i, k; @@ -2001,7 +2001,7 @@ public class ArgParser */ public String[] matchAllArgs (String[] args, int idx, int exitFlags) { - Vector unmatched = new Vector(10); + Vector<String> unmatched = new Vector<String>(10); while (idx < args.length) { try @@ -2063,6 +2063,7 @@ public class ArgParser * @see ArgParser#getErrorMessage * @see ArgParser#getUnmatchedArgument */ + @SuppressWarnings("unchecked") public int matchArg (String[] args, int idx) throws ArgParseException { @@ -2121,7 +2122,7 @@ public class ArgParser } } if (rec.resHolder instanceof Vector) - { ((Vector)rec.resHolder).add (result); + { ((Vector<Object>)rec.resHolder).add (result); } } catch (ArgParseException e) diff --git a/pki/base/silent/src/com/netscape/pkisilent/argparser/ArgParserTest.java b/pki/base/silent/src/com/netscape/pkisilent/argparser/ArgParserTest.java index 652b7b849..579f0f59a 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/argparser/ArgParserTest.java +++ b/pki/base/silent/src/com/netscape/pkisilent/argparser/ArgParserTest.java @@ -64,7 +64,7 @@ public class ArgParserTest private static String[] argsFromString (String s) { - Vector vec = new Vector(100); + Vector<String> vec = new Vector<String>(100); try { ArgParser.stringToArgs (vec, s, /*allowQuotedStings=*/false); } @@ -632,7 +632,7 @@ public class ArgParserTest if (resultIdx >= 0) { verify (result instanceof Vector, "Expecting result to be stored in a vector"); - Vector vec = (Vector)result; + Vector<?> vec = (Vector<?>)result; verify (vec.size()==resultIdx+1, "Expecting result vector size " + (resultIdx+1)); return vec.get(resultIdx); @@ -1128,7 +1128,7 @@ public class ArgParserTest }; test.checkMatches (tests, MULTI_WORD); - Vector vec = new Vector(100); + Vector<String> vec = new Vector<String>(100); test.checkAdd ("-foov3 %iX3", vec,'i',3,"-foov3 ",null,"",null); tests = new MTest[] diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/CMSProperties.java b/pki/base/silent/src/com/netscape/pkisilent/common/CMSProperties.java index e4ea36019..bae3e4202 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/common/CMSProperties.java +++ b/pki/base/silent/src/com/netscape/pkisilent/common/CMSProperties.java @@ -78,7 +78,7 @@ import java.util.Hashtable; * @since JDK1.0 */ -class CMSProperties extends Hashtable { +class CMSProperties extends Hashtable<String,String> { /** * use serialVersionUID from JDK 1.1.X for interoperability @@ -543,9 +543,9 @@ class CMSProperties extends Hashtable { writeln(awriter, "#" + header); } writeln(awriter, "#" + new Date().toString()); - for (Enumeration e = keys(); e.hasMoreElements();) { - String key = (String) e.nextElement(); - String val = (String) get(key); + for (Enumeration<String> e = keys(); e.hasMoreElements();) { + String key = e.nextElement(); + String val = get(key); key = saveConvert(key, true); @@ -575,8 +575,8 @@ class CMSProperties extends Hashtable { * @see #defaults */ public String getProperty(String key) { - Object oval = super.get(key); - String sval = (oval instanceof String) ? (String) oval : null; + String oval = super.get(key); + String sval = (oval instanceof String) ? oval : null; return ((sval == null) && (defaults != null)) ? defaults.getProperty(key) @@ -611,8 +611,8 @@ class CMSProperties extends Hashtable { * @see java.util.Enumeration * @see java.util.Properties#defaults */ - public Enumeration propertyNames() { - Hashtable h = new Hashtable(); + public Enumeration<String> propertyNames() { + Hashtable<String, String> h = new Hashtable<String, String>(); enumerate(h); return h.keys(); @@ -626,12 +626,12 @@ class CMSProperties extends Hashtable { */ public void list(PrintStream out) { out.println("-- listing properties --"); - Hashtable h = new Hashtable(); + Hashtable<String, String> h = new Hashtable<String, String>(); enumerate(h); - for (Enumeration e = h.keys(); e.hasMoreElements();) { - String key = (String) e.nextElement(); - String val = (String) h.get(key); + for (Enumeration<String> e = h.keys(); e.hasMoreElements();) { + String key = e.nextElement(); + String val = h.get(key); if (val.length() > 40) { val = val.substring(0, 37) + "..."; @@ -655,12 +655,12 @@ class CMSProperties extends Hashtable { */ public void list(PrintWriter out) { out.println("-- listing properties --"); - Hashtable h = new Hashtable(); + Hashtable<String, String> h = new Hashtable<String, String>(); enumerate(h); - for (Enumeration e = h.keys(); e.hasMoreElements();) { - String key = (String) e.nextElement(); - String val = (String) h.get(key); + for (Enumeration<String> e = h.keys(); e.hasMoreElements();) { + String key = e.nextElement(); + String val = h.get(key); if (val.length() > 40) { val = val.substring(0, 37) + "..."; @@ -673,12 +673,12 @@ class CMSProperties extends Hashtable { * Enumerates all key/value pairs in the specified hastable. * @param h the hashtable */ - private synchronized void enumerate(Hashtable h) { + private synchronized void enumerate(Hashtable<String, String> h) { if (defaults != null) { defaults.enumerate(h); } - for (Enumeration e = keys(); e.hasMoreElements();) { - String key = (String) e.nextElement(); + for (Enumeration<String> e = keys(); e.hasMoreElements();) { + String key = e.nextElement(); h.put(key, get(key)); } diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/Con2Agent.java b/pki/base/silent/src/com/netscape/pkisilent/common/Con2Agent.java index 584d68ce1..6be4daf49 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/common/Con2Agent.java +++ b/pki/base/silent/src/com/netscape/pkisilent/common/Con2Agent.java @@ -75,8 +75,8 @@ public class Con2Agent implements SSLClientCertificateSelectionCallback, return true; } - public String select(Vector nicknames) { - Enumeration e = nicknames.elements(); + public String select(@SuppressWarnings("rawtypes") Vector nicknames) { + Enumeration<?> e = nicknames.elements(); System.out.println("nicknames size = " + nicknames.size()); int i = 0; diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/ParseXML.java b/pki/base/silent/src/com/netscape/pkisilent/common/ParseXML.java index e430bb6ae..79be5c35b 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/common/ParseXML.java +++ b/pki/base/silent/src/com/netscape/pkisilent/common/ParseXML.java @@ -125,9 +125,9 @@ public class ParseXML { // returns an arraylist of values for the corresponding tag - public ArrayList constructvaluelist(String first, String second) { + public ArrayList<String> constructValueList(String first, String second) { String temp = null; - ArrayList al = new ArrayList(); + ArrayList<String> al = new ArrayList<String>(); try { // get the root elememt diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/Request.java b/pki/base/silent/src/com/netscape/pkisilent/common/Request.java index c10cafa29..9ddc99702 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/common/Request.java +++ b/pki/base/silent/src/com/netscape/pkisilent/common/Request.java @@ -49,7 +49,7 @@ public class Request extends TestClient { private String approveseqnumFrom, approveseqnumTo; // Request variables - private Vector seqNum = new Vector(); + private Vector<String> seqNum = new Vector<String>(); private String AUTH_ID = null; // Cert Detail variables @@ -154,7 +154,7 @@ public class Request extends TestClient { * @param endrequestnumber. */ - public Vector ListPendingRequests(String fromRequestNumber, String toRequestNumber) { + public Vector<String> ListPendingRequests(String fromRequestNumber, String toRequestNumber) { reqState = "showWaiting"; reqType = "enrollment"; approveseqnumFrom = fromRequestNumber; @@ -170,7 +170,7 @@ public class Request extends TestClient { */ - public Vector ListAllRequests(String fromRequestNumber, String toRequestNumber) { + public Vector<String> ListAllRequests(String fromRequestNumber, String toRequestNumber) { reqState = "showAll"; reqType = "enrollment"; approveseqnumFrom = fromRequestNumber; diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/Utilities.java b/pki/base/silent/src/com/netscape/pkisilent/common/Utilities.java index fa5c7c4a8..192ba0564 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/common/Utilities.java +++ b/pki/base/silent/src/com/netscape/pkisilent/common/Utilities.java @@ -327,7 +327,8 @@ public class Utilities { CertificateSubjectName csn1 = (CertificateSubjectName) certinfo.get(X509CertInfo.SUBJECT); - Enumeration en = csn1.getElements(); + @SuppressWarnings("unchecked") + Enumeration<String> en = csn1.getElements(); X500Name dname = (X500Name) csn1.get(CertificateSubjectName.DN_NAME); diff --git a/pki/base/silent/src/com/netscape/pkisilent/http/CertSelection.java b/pki/base/silent/src/com/netscape/pkisilent/http/CertSelection.java index a759cca2c..078bb5882 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/http/CertSelection.java +++ b/pki/base/silent/src/com/netscape/pkisilent/http/CertSelection.java @@ -33,7 +33,7 @@ public class CertSelection implements SSLClientCertificateSelectionCallback client_cert = nickname; } - public String select(Vector nicknames) + public String select(@SuppressWarnings("rawtypes") Vector nicknames) { // when this method is called by SSLSocket we get a vector diff --git a/pki/base/silent/src/com/netscape/pkisilent/http/HTMLDocument.java b/pki/base/silent/src/com/netscape/pkisilent/http/HTMLDocument.java index 8d6048dea..df95f8611 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/http/HTMLDocument.java +++ b/pki/base/silent/src/com/netscape/pkisilent/http/HTMLDocument.java @@ -35,16 +35,16 @@ public class HTMLDocument // A list of URLs of files that should be retrieved along with the main // contents of the document. This may include any images contained in the // document, and possibly any external stylesheets. - LinkedHashSet associatedFiles; + LinkedHashSet<String> associatedFiles; // A list of URLs of frames that are contained in the document. - LinkedHashSet documentFrames; + LinkedHashSet<String> documentFrames; // A list of URLs of links that are contained in the document. - LinkedHashSet documentLinks; + LinkedHashSet<String> documentLinks; // A list of URLs of images that are contained in the document. - LinkedHashSet documentImages; + LinkedHashSet<String> documentImages; // A regular expression pattern that can be used to extract a URI from an HREF // tag. @@ -210,10 +210,10 @@ public class HTMLDocument try { - associatedFiles = new LinkedHashSet(); - documentFrames = new LinkedHashSet(); - documentLinks = new LinkedHashSet(); - documentImages = new LinkedHashSet(); + associatedFiles = new LinkedHashSet<String>(); + documentFrames = new LinkedHashSet<String>(); + documentLinks = new LinkedHashSet<String>(); + documentImages = new LinkedHashSet<String>(); textData = new StringBuffer(); lastElementStartPos = 0; diff --git a/pki/base/silent/src/com/netscape/pkisilent/http/HTTPClient.java b/pki/base/silent/src/com/netscape/pkisilent/http/HTTPClient.java index 4431be8ef..9c840fcdc 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/http/HTTPClient.java +++ b/pki/base/silent/src/com/netscape/pkisilent/http/HTTPClient.java @@ -1008,7 +1008,7 @@ public class HTTPClient implements SSLCertificateApprovalCallback { // Create an array list that we will use to hold the chunks of information // read from the server. - ArrayList bufferList = new ArrayList(); + ArrayList<ByteBuffer> bufferList = new ArrayList<ByteBuffer>(); // Create a variable to hold the total number of bytes in the data. diff --git a/pki/base/silent/src/com/netscape/pkisilent/http/HTTPResponse.java b/pki/base/silent/src/com/netscape/pkisilent/http/HTTPResponse.java index 5b88ac277..08358f357 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/http/HTTPResponse.java +++ b/pki/base/silent/src/com/netscape/pkisilent/http/HTTPResponse.java @@ -27,13 +27,13 @@ import com.netscape.pkisilent.common.Utilities; public class HTTPResponse { // The set of cookie values included in this response. - ArrayList cookieValueList; + ArrayList<String> cookieValueList; // The names of the headers included in this response. - ArrayList headerNameList; + ArrayList<String> headerNameList; // The values of the headers included in this response. - ArrayList headerValueList; + ArrayList<String> headerValueList; // The actual data associated with this response. byte[] responseData; @@ -57,8 +57,8 @@ public class HTTPResponse String responseMessage; // Parsed Content Name/Value pair info - ArrayList contentName; - ArrayList contentValue; + ArrayList<String> contentName; + ArrayList<String> contentValue; @@ -80,11 +80,11 @@ public class HTTPResponse contentType = null; contentLength = -1; responseData = new byte[0]; - cookieValueList = new ArrayList(); - headerNameList = new ArrayList(); - headerValueList = new ArrayList(); - contentName = new ArrayList(); - contentValue = new ArrayList(); + cookieValueList = new ArrayList<String>(); + headerNameList = new ArrayList<String>(); + headerValueList = new ArrayList<String>(); + contentName = new ArrayList<String>(); + contentValue = new ArrayList<String>(); } @@ -141,7 +141,7 @@ public class HTTPResponse { if (lowerName.equals(headerNameList.get(i))) { - return (String) headerValueList.get(i); + return headerValueList.get(i); } } @@ -157,7 +157,7 @@ public class HTTPResponse */ public String[] getHeaderValues(String headerName) { - ArrayList valueList = new ArrayList(); + ArrayList<String> valueList = new ArrayList<String>(); String lowerName = headerName.toLowerCase(); for (int i=0; i < headerNameList.size(); i++) @@ -218,8 +218,8 @@ public class HTTPResponse String[][] headerElements = new String[headerNameList.size()][2]; for (int i=0; i < headerNameList.size(); i++) { - headerElements[i][0] = (String) headerNameList.get(i); - headerElements[i][1] = (String) headerValueList.get(i); + headerElements[i][0] = headerNameList.get(i); + headerElements[i][1] = headerValueList.get(i); } return headerElements; @@ -288,19 +288,19 @@ public class HTTPResponse { if (headerName.equals(contentName.get(i))) { - return (String) contentValue.get(i); + return contentValue.get(i); } } return null; } - public ArrayList getContentNames() + public ArrayList<String> getContentNames() { return contentName; } - public ArrayList getContentValues() + public ArrayList<String> getContentValues() { return contentValue; } @@ -370,10 +370,10 @@ public class HTTPResponse { System.out.println("cookie list: " + cookieValueList.get(i)); - String temp = (String) cookieValueList.get(i); + String temp = cookieValueList.get(i); if (temp.startsWith(headerName)) { - return (String) cookieValueList.get(i); + return cookieValueList.get(i); } } |