diff options
author | Endi Sukma Dewata <edewata@redhat.com> | 2012-01-12 18:53:36 -0600 |
---|---|---|
committer | Endi Sukma Dewata <edewata@redhat.com> | 2012-01-18 12:55:59 -0600 |
commit | 2a535f04f7b7bf670b19b95801e25178af5c91f9 (patch) | |
tree | 5e8356739fecf71d6b132e026d95ffb52bf2cdbf /pki/base/common/src/com/netscape/cms/servlet | |
parent | 9115902d5d3ffa4ac905f5d1f9fbd18a8e99622c (diff) | |
download | pki-2a535f04f7b7bf670b19b95801e25178af5c91f9.tar.gz pki-2a535f04f7b7bf670b19b95801e25178af5c91f9.tar.xz pki-2a535f04f7b7bf670b19b95801e25178af5c91f9.zip |
Added generics (part 1).
This patch is based on Adam's patch. It brings down the warnings
from 6139 to 4648.
Ticket #2
Diffstat (limited to 'pki/base/common/src/com/netscape/cms/servlet')
40 files changed, 436 insertions, 352 deletions
diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/CMSAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/CMSAdminServlet.java index 92cbb8885..41f0c248f 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/CMSAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/CMSAdminServlet.java @@ -354,7 +354,7 @@ public final class CMSAdminServlet extends AdminServlet { } private boolean isSubsystemInstalled(String subsystem) { - Enumeration e = CMS.getSubsystems(); + Enumeration<ISubsystem> e = CMS.getSubsystems(); while (e.hasMoreElements()) { String type = ""; @@ -382,7 +382,7 @@ public final class CMSAdminServlet extends AdminServlet { HttpServletResponse resp) throws ServletException, IOException, EBaseException { - Enumeration e = CMS.getSubsystems(); + Enumeration<ISubsystem> e = CMS.getSubsystems(); boolean isCAInstalled = false; boolean isRAInstalled = false; boolean isKRAInstalled = false; @@ -536,13 +536,14 @@ public final class CMSAdminServlet extends AdminServlet { // ensure that any low-level exceptions are reported // to the signed audit log and stored as failures try { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); NameValuePairs params = new NameValuePairs(); ICryptoSubsystem jssSubSystem = (ICryptoSubsystem) CMS.getSubsystem(CMS.SUBSYSTEM_CRYPTO); jssSubSystem.getInternalTokenName(); - Enumeration e = CMS.getSubsystems(); + Enumeration<ISubsystem> e = CMS.getSubsystems(); boolean isCAInstalled = false; boolean isRAInstalled = false; boolean isKRAInstalled = false; @@ -797,7 +798,7 @@ public final class CMSAdminServlet extends AdminServlet { HttpServletResponse resp) throws ServletException, IOException, EBaseException { NameValuePairs params = new NameValuePairs(); - Enumeration e = CMS.getSubsystems(); + Enumeration<ISubsystem> e = CMS.getSubsystems(); StringBuffer buff = new StringBuffer(); while (e.hasMoreElements()) { @@ -863,7 +864,8 @@ public final class CMSAdminServlet extends AdminServlet { IOException, EBaseException { IConfigStore dbConfig = mConfig.getSubStore(PROP_INTERNAL_DB); - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); while (enum1.hasMoreElements()) { String key = (String) enum1.nextElement(); @@ -890,7 +892,8 @@ public final class CMSAdminServlet extends AdminServlet { IOException, EBaseException { NameValuePairs params = new NameValuePairs(); - Enumeration e = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> e = req.getParameterNames(); String newKeyName = null, selectedToken = null; while (e.hasMoreElements()) { String name = (String) e.nextElement(); @@ -923,7 +926,8 @@ public final class CMSAdminServlet extends AdminServlet { IOException, EBaseException { NameValuePairs params = new NameValuePairs(); - Enumeration e = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> e = req.getParameterNames(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); @@ -974,7 +978,8 @@ public final class CMSAdminServlet extends AdminServlet { IConfigStore dbConfig = mConfig.getSubStore(PROP_DB); IConfigStore ldapConfig = dbConfig.getSubStore("ldap"); NameValuePairs params = new NameValuePairs(); - Enumeration e = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> e = req.getParameterNames(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); @@ -1036,7 +1041,8 @@ public final class CMSAdminServlet extends AdminServlet { private void loggedInToken(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException, EBaseException { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); String tokenName = ""; String pwd = ""; @@ -1064,7 +1070,8 @@ public final class CMSAdminServlet extends AdminServlet { private void checkTokenStatus(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException, EBaseException { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); String key = ""; String value = ""; @@ -1110,7 +1117,8 @@ public final class CMSAdminServlet extends AdminServlet { // to the signed audit log and stored as failures try { NameValuePairs params = new NameValuePairs(); - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); String tokenName = Constants.PR_INTERNAL_TOKEN_NAME; String keyType = ""; int keyLength = 512; @@ -1486,7 +1494,8 @@ public final class CMSAdminServlet extends AdminServlet { // ensure that any low-level exceptions are reported // to the signed audit log and stored as failures try { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); String pkcs = ""; String type = ""; String tokenName = Constants.PR_INTERNAL_TOKEN_NAME; @@ -1921,7 +1930,8 @@ public final class CMSAdminServlet extends AdminServlet { String serverRoot = ""; String serverID = ""; String certpath = ""; - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); while (enum1.hasMoreElements()) { String key = (String) enum1.nextElement(); @@ -2086,8 +2096,8 @@ public final class CMSAdminServlet extends AdminServlet { String eString = e.toString(); if (eString.contains("Failed to find certificate that was just imported")) { - CMS.debug("CMSAdminServlet.installCert(): nickname=" + nicknameWithoutTokenName - + " TokenException: " + eString); + CMS.debug("CMSAdminServlet.installCert(): nickname=" + + nicknameWithoutTokenName + " TokenException: " + eString); X509Certificate cert = null; try { @@ -2338,7 +2348,8 @@ public final class CMSAdminServlet extends AdminServlet { String serverRoot = ""; String serverID = ""; String certpath = ""; - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); NameValuePairs results = new NameValuePairs(); while (enum1.hasMoreElements()) { @@ -2565,7 +2576,8 @@ public final class CMSAdminServlet extends AdminServlet { private void getCertInfo(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException, EBaseException { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); NameValuePairs results = new NameValuePairs(); String pkcs = ""; String path = ""; @@ -2662,7 +2674,8 @@ public final class CMSAdminServlet extends AdminServlet { private void getCertPrettyPrint(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException, EBaseException { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); ICryptoSubsystem jssSubSystem = (ICryptoSubsystem) CMS.getSubsystem(CMS.SUBSYSTEM_CRYPTO); String nickname = ""; @@ -2705,7 +2718,8 @@ public final class CMSAdminServlet extends AdminServlet { private void getRootCertTrustBit(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException, EBaseException { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); ICryptoSubsystem jssSubSystem = (ICryptoSubsystem) CMS.getSubsystem(CMS.SUBSYSTEM_CRYPTO); String nickname = ""; @@ -2821,7 +2835,8 @@ public final class CMSAdminServlet extends AdminServlet { private void deleteCerts(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException, EBaseException { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); ICryptoSubsystem jssSubSystem = (ICryptoSubsystem) CMS.getSubsystem(CMS.SUBSYSTEM_CRYPTO); String nickname = ""; @@ -2853,8 +2868,8 @@ public final class CMSAdminServlet extends AdminServlet { private void validateSubjectName(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException, EBaseException { - - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); while (enum1.hasMoreElements()) { String key = (String) enum1.nextElement(); @@ -2874,7 +2889,8 @@ public final class CMSAdminServlet extends AdminServlet { private void validateKeyLength(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException, EBaseException { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); String keyType = "RSA"; String keyLen = "512"; String certType = ""; @@ -2904,7 +2920,8 @@ public final class CMSAdminServlet extends AdminServlet { private void validateCurveName(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException, EBaseException { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); String curveName = null; while (enum1.hasMoreElements()) { @@ -2934,7 +2951,8 @@ public final class CMSAdminServlet extends AdminServlet { private void validateCertExtension(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException, EBaseException { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); String certExt = ""; while (enum1.hasMoreElements()) { @@ -2958,7 +2976,8 @@ public final class CMSAdminServlet extends AdminServlet { HttpServletResponse resp) throws ServletException, IOException, EBaseException { NameValuePairs params = new NameValuePairs(); - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); String nickname = ""; String keyType = "RSA"; @@ -2989,7 +3008,8 @@ public final class CMSAdminServlet extends AdminServlet { HttpServletResponse resp) throws ServletException, IOException, EBaseException { NameValuePairs params = new NameValuePairs(); - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); String nickname = ""; String keyType = "RSA"; @@ -3078,7 +3098,8 @@ public final class CMSAdminServlet extends AdminServlet { // ensure that any low-level exceptions are reported // to the signed audit log and stored as failures try { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); ICryptoSubsystem jssSubSystem = (ICryptoSubsystem) CMS.getSubsystem(CMS.SUBSYSTEM_CRYPTO); String trust = ""; @@ -3178,8 +3199,8 @@ public final class CMSAdminServlet extends AdminServlet { CMS.debug("CMSAdminServlet::runSelfTestsOnDemand():" + " ENTERING . . ."); } - - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); String request = ""; NameValuePairs results = new NameValuePairs(); String content = ""; diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/ProfileAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/ProfileAdminServlet.java index 57fadab47..cbc406997 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/ProfileAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/ProfileAdminServlet.java @@ -1981,7 +1981,8 @@ public class ProfileAdminServlet extends AdminServlet { nvp.add(name, ";" + ";" + rule.getConfig(name)); } else { nvp.add(name, - desc.getSyntax() + ";" + ";" + getNonNull(desc.getConstraint()) + ";" + desc.getSyntax() + + ";" + ";" + getNonNull(desc.getConstraint()) + ";" + desc.getDescription(getLocale(req)) + ";" + rule.getConfig(name)); } } @@ -2031,8 +2032,9 @@ public class ProfileAdminServlet extends AdminServlet { nvp.add(name, ";" + rule.getConfig(name)); } else { nvp.add(name, - desc.getSyntax() + ";" + getNonNull(desc.getConstraint()) + ";" - + desc.getDescription(getLocale(req)) + ";" + rule.getConfig(name)); + desc.getSyntax() + + ";" + getNonNull(desc.getConstraint()) + ";" + desc.getDescription(getLocale(req)) + + ";" + rule.getConfig(name)); } } sendResponse(SUCCESS, null, nvp, resp); diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/PublisherAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/PublisherAdminServlet.java index e8d80640e..58cf327bb 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/PublisherAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/PublisherAdminServlet.java @@ -353,13 +353,15 @@ public class PublisherAdminServlet extends AdminServlet { String epi[] = new String[] { "type;choice(cacert,crl,certs,xcert);The certType of the request", - "mapper;choice(" + map.toString() + "mapper;choice(" + + map.toString() + ");Use the mapper to find the ldap dn to publish the certificate or crl", - "publisher;choice(" + publish.toString() + "publisher;choice(" + + publish.toString() + ");Use the publisher to publish the certificate or crl a directory etc", "enable;boolean;", "predicate;string;" - }; + }; return new ExtendedPluginInfo(epi); } @@ -714,9 +716,10 @@ public class PublisherAdminServlet extends AdminServlet { if (authType.equals(ILdapAuthInfo.LDAP_SSLCLIENTAUTH_STR)) { try { //certNickName = authInfo.getParms()[0]; - certNickName = ldap.getSubStore( - ILdapBoundConnFactory.PROP_LDAPAUTHINFO).getString( - ILdapAuthInfo.PROP_CLIENTCERTNICKNAME); + certNickName = + ldap.getSubStore( + ILdapBoundConnFactory.PROP_LDAPAUTHINFO).getString( + ILdapAuthInfo.PROP_CLIENTCERTNICKNAME); conn = new LDAPConnection(CMS.getLdapJssSSLSocketFactory( certNickName)); CMS.debug("Publishing Test certNickName=" + certNickName); @@ -725,7 +728,8 @@ public class PublisherAdminServlet extends AdminServlet { certNickName + dashes(70 - 44 - certNickName.length()) + " Success"); } catch (Exception ex) { params.add(Constants.PR_CONN_INIT_FAIL, - "Create ssl LDAPConnection with certificate: " + + "Create ssl LDAPConnection with certificate: " + + certNickName + dashes(70 - 44 - certNickName.length()) + " failure\n" + " exception: " + ex); params.add(Constants.PR_SAVE_NOT, @@ -737,7 +741,8 @@ public class PublisherAdminServlet extends AdminServlet { try { conn.connect(host, port); params.add(Constants.PR_CONN_OK, - "Connect to directory server " + + "Connect to directory server " + + host + " at port " + port + dashes(70 - 37 - host.length() - (Integer.valueOf(port)).toString().length()) + " Success"); @@ -799,7 +804,8 @@ public class PublisherAdminServlet extends AdminServlet { try { conn.connect(host, port); params.add(Constants.PR_CONN_OK, - "Connect to directory server " + + "Connect to directory server " + + host + " at port " + port + dashes(70 - 37 - host.length() - (Integer.valueOf(port)).toString().length()) + " Success"); @@ -808,14 +814,16 @@ public class PublisherAdminServlet extends AdminServlet { // need to intercept this because message from LDAP is // "DSA is unavailable" which confuses with DSA PKI. params.add(Constants.PR_CONN_FAIL, - "Connect to directory server " + + "Connect to directory server " + + host + " at port " + port + dashes(70 - 37 - host.length() - (Integer.valueOf(port)).toString().length()) + " Failure" + "\nerror: server unavailable"); } else { params.add(Constants.PR_CONN_FAIL, - "Connect to directory server " + + "Connect to directory server " + + host + " at port " + port + dashes(70 - 37 - host.length() - (Integer.valueOf(port)).toString().length()) + " Failure" + diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/RegistryAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/RegistryAdminServlet.java index 41c07d810..0175d9aa4 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/RegistryAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/RegistryAdminServlet.java @@ -290,7 +290,8 @@ public class RegistryAdminServlet extends AdminServlet { CMS.debug("RegistryAdminServlet: getSUpportedConstraint isApplicable " + constraintInfo.getClassName()); nvp.add(constraintID, - constraintInfo.getClassName() + "," + + constraintInfo.getClassName() + + "," + constraintInfo.getDescription(getLocale(req)) + "," + constraintInfo.getName(getLocale(req))); } @@ -344,8 +345,11 @@ public class RegistryAdminServlet extends AdminServlet { if (desc != null) { try { - String value = getNonNull(desc.getSyntax()) + ";" + getNonNull(desc.getConstraint()) + ";" - + desc.getDescription(getLocale(req)) + ";" + getNonNull(desc.getDefaultValue()); + String value = + getNonNull(desc.getSyntax()) + + ";" + getNonNull(desc.getConstraint()) + ";" + + desc.getDescription(getLocale(req)) + ";" + + getNonNull(desc.getDefaultValue()); CMS.debug("RegistryAdminServlet: getProfileImpl " + value); nvp.add(name, value); diff --git a/pki/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java b/pki/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java index 2920d0f46..e292e501a 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java @@ -493,8 +493,8 @@ public abstract class CMSServlet extends HttpServlet { Date endDate = CMS.getCurrentDate(); long endTime = endDate.getTime(); if (CMS.debugOn()) { - CMS.debug(CMS.DEBUG_INFORM, "CMSServlet: curDate=" + endDate + " id=" + mId + " time=" - + (endTime - startTime)); + CMS.debug(CMS.DEBUG_INFORM, "CMSServlet: curDate=" + + endDate + " id=" + mId + " time=" + (endTime - startTime)); } iCommandQueue.unRegisterProccess((Object) cmsRequest, (Object) this); } catch (EBaseException e) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/CMCRevReqServlet.java b/pki/base/common/src/com/netscape/cms/servlet/cert/CMCRevReqServlet.java index 0d7da7fa8..461fa0b94 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/CMCRevReqServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/CMCRevReqServlet.java @@ -236,8 +236,9 @@ public class CMCRevReqServlet extends CMSServlet { certs = new X509CertImpl[serialNoArray.length]; for (int i = 0; i < serialNoArray.length; i++) { - certs[i] = ((ICertificateAuthority) mAuthority).getCertificateRepository().getX509Certificate( - serialNoArray[i]); + certs[i] = + ((ICertificateAuthority) mAuthority).getCertificateRepository().getX509Certificate( + serialNoArray[i]); } } else if (mAuthority instanceof IRegistrationAuthority) { @@ -379,8 +380,8 @@ public class CMCRevReqServlet extends CMSServlet { try { int count = 0; - Vector oldCertsV = new Vector(); - Vector revCertImplsV = new Vector(); + Vector<X509CertImpl> oldCertsV = new Vector<X509CertImpl>(); + Vector<RevokedCertImpl> revCertImplsV = new Vector<RevokedCertImpl>(); // Construct a CRL reason code extension. RevocationReason revReason = RevocationReason.fromInt(reason); @@ -406,7 +407,7 @@ public class CMCRevReqServlet extends CMSServlet { if (mAuthority instanceof ICertificateAuthority) { ICertRecordList list = (ICertRecordList) mCertDB.findCertRecordsInList( revokeAll, null, totalRecordCount); - Enumeration e = list.getCertRecords(0, totalRecordCount - 1); + Enumeration<ICertRecord> e = list.getCertRecords(0, totalRecordCount - 1); while (e != null && e.hasMoreElements()) { ICertRecord rec = (ICertRecord) e.nextElement(); @@ -439,11 +440,11 @@ public class CMCRevReqServlet extends CMSServlet { if (mRequestID != null && mRequestID.length() > 0) reqIdStr = mRequestID; - Vector serialNumbers = new Vector(); + Vector<String> serialNumbers = new Vector<String>(); if (revokeAll != null && revokeAll.length() > 0) { - for (int i = revokeAll.indexOf('='); i < revokeAll.length() && i > -1; i = revokeAll - .indexOf('=', i)) { + for (int i = revokeAll.indexOf('='); i < revokeAll.length() && i > -1; i = + revokeAll.indexOf('=', i)) { if (i > -1) { i++; while (i < revokeAll.length() && revokeAll.charAt(i) == ' ') { @@ -654,7 +655,7 @@ public class CMCRevReqServlet extends CMSServlet { } if (mAuthority instanceof ICertificateAuthority) { // let known update and publish status of all crls. - Enumeration otherCRLs = + Enumeration<ICRLIssuingPoint> otherCRLs = ((ICertificateAuthority) mAuthority).getCRLIssuingPoints(); while (otherCRLs.hasMoreElements()) { @@ -761,7 +762,7 @@ public class CMCRevReqServlet extends CMSServlet { } } else { - Vector errors = revReq.getExtDataInStringVector(IRequest.ERRORS); + Vector<String> errors = revReq.getExtDataInStringVector(IRequest.ERRORS); StringBuffer errorStr = new StringBuffer(); if (errors != null && errors.size() > 0) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/ChallengeRevocationServlet1.java b/pki/base/common/src/com/netscape/cms/servlet/cert/ChallengeRevocationServlet1.java index 14f28bce9..8ca35484b 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/ChallengeRevocationServlet1.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/ChallengeRevocationServlet1.java @@ -213,8 +213,9 @@ public class ChallengeRevocationServlet1 extends CMSServlet { certs = new X509CertImpl[serialNoArray.length]; for (int i = 0; i < serialNoArray.length; i++) { - certs[i] = ((ICertificateAuthority) mAuthority).getCertificateRepository().getX509Certificate( - serialNoArray[i]); + certs[i] = + ((ICertificateAuthority) mAuthority).getCertificateRepository().getX509Certificate( + serialNoArray[i]); } } else if (mAuthority instanceof IRegistrationAuthority) { @@ -308,8 +309,8 @@ public class ChallengeRevocationServlet1 extends CMSServlet { throws EBaseException { try { int count = 0; - Vector oldCertsV = new Vector(); - Vector revCertImplsV = new Vector(); + Vector<X509CertImpl> oldCertsV = new Vector<X509CertImpl>(); + Vector<RevokedCertImpl> revCertImplsV = new Vector<RevokedCertImpl>(); // Construct a CRL reason code extension. RevocationReason revReason = RevocationReason.fromInt(reason); @@ -335,7 +336,7 @@ public class ChallengeRevocationServlet1 extends CMSServlet { if (mAuthority instanceof ICertificateAuthority) { ICertRecordList list = (ICertRecordList) mCertDB.findCertRecordsInList( revokeAll, null, totalRecordCount); - Enumeration e = list.getCertRecords(0, totalRecordCount - 1); + Enumeration<ICertRecord> e = list.getCertRecords(0, totalRecordCount - 1); while (e != null && e.hasMoreElements()) { ICertRecord rec = (ICertRecord) e.nextElement(); @@ -368,7 +369,7 @@ public class ChallengeRevocationServlet1 extends CMSServlet { if (mRequestID != null && mRequestID.length() > 0) reqIdStr = mRequestID; - Vector serialNumbers = new Vector(); + Vector<String> serialNumbers = new Vector<String>(); if (revokeAll != null && revokeAll.length() > 0) { for (int i = revokeAll.indexOf('='); i < revokeAll.length() && i > -1; @@ -563,7 +564,7 @@ public class ChallengeRevocationServlet1 extends CMSServlet { } if (mAuthority instanceof ICertificateAuthority) { // let known update and publish status of all crls. - Enumeration otherCRLs = + Enumeration<ICRLIssuingPoint> otherCRLs = ((ICertificateAuthority) mAuthority).getCRLIssuingPoints(); while (otherCRLs.hasMoreElements()) { @@ -672,7 +673,7 @@ public class ChallengeRevocationServlet1 extends CMSServlet { } } else { - Vector errors = revReq.getExtDataInStringVector(IRequest.ERRORS); + Vector<String> errors = revReq.getExtDataInStringVector(IRequest.ERRORS); StringBuffer errorStr = new StringBuffer(); if (errors != null && errors.size() > 0) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/DisplayBySerial.java b/pki/base/common/src/com/netscape/cms/servlet/cert/DisplayBySerial.java index 1c9838f83..36746106a 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/DisplayBySerial.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/DisplayBySerial.java @@ -309,8 +309,8 @@ public class DisplayBySerial extends CMSServlet { String rid = (String) metaInfo.get(ICertRecord.META_REQUEST_ID); if (rid != null && mAuthority instanceof ICertificateAuthority) { - IRequest r = ((ICertificateAuthority) mAuthority).getRequestQueue().findRequest( - new RequestId(rid)); + IRequest r = + ((ICertificateAuthority) mAuthority).getRequestQueue().findRequest(new RequestId(rid)); String certType = r.getExtDataInString(IRequest.HTTP_PARAMS, IRequest.CERT_TYPE); if (certType != null && certType.equals(IRequest.CLIENT_CERT)) { @@ -331,7 +331,7 @@ public class DisplayBySerial extends CMSServlet { CRLExtensions crlExts = revocationInfo.getCRLEntryExtensions(); if (crlExts != null) { - Enumeration enumx = crlExts.getElements(); + Enumeration<Extension> enumx = crlExts.getElements(); int reason = 0; while (enumx.hasMoreElements()) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/DoRevoke.java b/pki/base/common/src/com/netscape/cms/servlet/cert/DoRevoke.java index 97a70fac3..b84f5ace1 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/DoRevoke.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/DoRevoke.java @@ -439,8 +439,8 @@ public class DoRevoke extends CMSServlet { try { int count = 0; - Vector oldCertsV = new Vector(); - Vector revCertImplsV = new Vector(); + Vector<X509CertImpl> oldCertsV = new Vector<X509CertImpl>(); + Vector<RevokedCertImpl> revCertImplsV = new Vector<RevokedCertImpl>(); // Construct a CRL reason code extension. RevocationReason revReason = RevocationReason.fromInt(reason); @@ -465,11 +465,11 @@ public class DoRevoke extends CMSServlet { if (mAuthority instanceof ICertificateAuthority) { - Enumeration e = mCertDB.searchCertificates(revokeAll, + Enumeration<ICertRecord> e = mCertDB.searchCertificates(revokeAll, totalRecordCount, mTimeLimits); while (e != null && e.hasMoreElements()) { - ICertRecord rec = (ICertRecord) e.nextElement(); + ICertRecord rec = e.nextElement(); if (rec == null) continue; @@ -532,7 +532,7 @@ public class DoRevoke extends CMSServlet { } else if (mAuthority instanceof IRegistrationAuthority) { String reqIdStr = req.getParameter("requestId"); - Vector serialNumbers = new Vector(); + Vector<String> serialNumbers = new Vector<String>(); if (revokeAll != null && revokeAll.length() > 0) { for (int i = revokeAll.indexOf('='); i < revokeAll.length() && i > -1; @@ -787,8 +787,8 @@ public class DoRevoke extends CMSServlet { "completed", cert.getSubjectDN(), cert.getSerialNumber().toString(16), - RevocationReason.fromInt(reason).toString() + " time: " - + (endTime - startTime) } + RevocationReason.fromInt(reason).toString() + + " time: " + (endTime - startTime) } ); } } @@ -833,7 +833,7 @@ public class DoRevoke extends CMSServlet { if (mAuthority instanceof ICertificateAuthority) { // let known update and publish status of all crls. - Enumeration otherCRLs = + Enumeration<ICRLIssuingPoint> otherCRLs = ((ICertificateAuthority) mAuthority).getCRLIssuingPoints(); while (otherCRLs.hasMoreElements()) { @@ -925,7 +925,7 @@ public class DoRevoke extends CMSServlet { } else { header.addStringValue("revoked", "no"); } - Vector errors = revReq.getExtDataInStringVector(IRequest.ERRORS); + Vector<String> errors = revReq.getExtDataInStringVector(IRequest.ERRORS); if (errors != null) { StringBuffer errInfo = new StringBuffer(); for (int i = 0; i < errors.size(); i++) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/DoRevokeTPS.java b/pki/base/common/src/com/netscape/cms/servlet/cert/DoRevokeTPS.java index 075f3218b..00cca204a 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/DoRevokeTPS.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/DoRevokeTPS.java @@ -353,8 +353,8 @@ public class DoRevokeTPS extends CMSServlet { try { int count = 0; - Vector oldCertsV = new Vector(); - Vector revCertImplsV = new Vector(); + Vector<X509CertImpl> oldCertsV = new Vector<X509CertImpl>(); + Vector<RevokedCertImpl> revCertImplsV = new Vector<RevokedCertImpl>(); // Construct a CRL reason code extension. RevocationReason revReason = RevocationReason.fromInt(reason); @@ -377,7 +377,7 @@ public class DoRevokeTPS extends CMSServlet { entryExtn.set(invalidityDateExtn.getName(), invalidityDateExtn); } - Enumeration e = mCertDB.searchCertificates(revokeAll, + Enumeration<ICertRecord> e = mCertDB.searchCertificates(revokeAll, totalRecordCount, mTimeLimits); boolean alreadyRevokedCertFound = false; @@ -593,8 +593,8 @@ public class DoRevokeTPS extends CMSServlet { "completed", cert.getSubjectDN(), cert.getSerialNumber().toString(16), - RevocationReason.fromInt(reason).toString() + " time: " - + (endTime - startTime) } + RevocationReason.fromInt(reason).toString() + + " time: " + (endTime - startTime) } ); } } @@ -633,7 +633,7 @@ public class DoRevokeTPS extends CMSServlet { if (mAuthority instanceof ICertificateAuthority) { // let known update and publish status of all crls. - Enumeration otherCRLs = + Enumeration<ICRLIssuingPoint> otherCRLs = ((ICertificateAuthority) mAuthority).getCRLIssuingPoints(); while (otherCRLs.hasMoreElements()) { @@ -718,7 +718,7 @@ public class DoRevokeTPS extends CMSServlet { o_status = "status=2"; errorString = "error=Undefined request status"; } - Vector errors = revReq.getExtDataInStringVector(IRequest.ERRORS); + Vector<String> errors = revReq.getExtDataInStringVector(IRequest.ERRORS); if (errors != null) { StringBuffer errInfo = new StringBuffer(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/EnrollServlet.java b/pki/base/common/src/com/netscape/cms/servlet/cert/EnrollServlet.java index 0c7b73780..7b3fb2f74 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/EnrollServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/EnrollServlet.java @@ -465,12 +465,13 @@ public class EnrollServlet extends CMSServlet { } String filter = - "(&(x509cert.subject=" + certBasedOldSubjectDN + ")(!(x509cert.serialNumber=" + certBasedOldSerialNum + "(&(x509cert.subject=" + + certBasedOldSubjectDN + ")(!(x509cert.serialNumber=" + certBasedOldSerialNum + "))(certStatus=VALID))"; ICertRecordList list = (ICertRecordList) mCa.getCertificateRepository().findCertRecordsInList(filter, null, 10); int size = list.getSize(); - Enumeration en = list.getCertRecords(0, size - 1); + Enumeration<ICertRecord> en = list.getCertRecords(0, size - 1); boolean gotEncCert = false; CMS.debug("EnrollServlet: signing cert filter " + filter); @@ -572,10 +573,10 @@ public class EnrollServlet extends CMSServlet { // audit log the status try { if (status == RequestStatus.REJECTED) { - Vector messages = req.getExtDataInStringVector(IRequest.ERRORS); + Vector<String> messages = req.getExtDataInStringVector(IRequest.ERRORS); if (messages != null) { - Enumeration msgs = messages.elements(); + Enumeration<String> msgs = messages.elements(); StringBuffer wholeMsg = new StringBuffer(); while (msgs.hasMoreElements()) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/HashEnrollServlet.java b/pki/base/common/src/com/netscape/cms/servlet/cert/HashEnrollServlet.java index e42150f87..4d5b711c0 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/HashEnrollServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/HashEnrollServlet.java @@ -487,13 +487,14 @@ public class HashEnrollServlet extends CMSServlet { } String filter = - "(&(x509cert.subject=" + certBasedOldSubjectDN + ")(!(x509cert.serialNumber=" - + certBasedOldSerialNum + "))(certStatus=VALID))"; + "(&(x509cert.subject=" + + certBasedOldSubjectDN + ")(!(x509cert.serialNumber=" + certBasedOldSerialNum + + "))(certStatus=VALID))"; ICertRecordList list = (ICertRecordList) mCa.getCertificateRepository().findCertRecordsInList(filter, null, 10); int size = list.getSize(); - Enumeration en = list.getCertRecords(0, size - 1); + Enumeration<ICertRecord> en = list.getCertRecords(0, size - 1); boolean gotEncCert = false; if (!en.hasMoreElements()) { @@ -656,10 +657,10 @@ public class HashEnrollServlet extends CMSServlet { // audit log the status try { if (status == RequestStatus.REJECTED) { - Vector messages = req.getExtDataInStringVector(IRequest.ERRORS); + Vector<String> messages = req.getExtDataInStringVector(IRequest.ERRORS); if (messages != null) { - Enumeration msgs = messages.elements(); + Enumeration<String> msgs = messages.elements(); StringBuffer wholeMsg = new StringBuffer(); while (msgs.hasMoreElements()) { @@ -947,8 +948,8 @@ public class HashEnrollServlet extends CMSServlet { // field suggested notBefore and notAfter in CRMF // Tech Support #383184 if (certTemplate.getNotBefore() != null || certTemplate.getNotAfter() != null) { - CertificateValidity certValidity = new CertificateValidity(certTemplate.getNotBefore(), - certTemplate.getNotAfter()); + CertificateValidity certValidity = + new CertificateValidity(certTemplate.getNotBefore(), certTemplate.getNotAfter()); certInfo.set(X509CertInfo.VALIDITY, certValidity); } diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/ListCerts.java b/pki/base/common/src/com/netscape/cms/servlet/cert/ListCerts.java index c12c8193d..8a818f5e8 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/ListCerts.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/ListCerts.java @@ -68,10 +68,8 @@ public class ListCerts extends CMSServlet { */ private static final long serialVersionUID = -3568155814023099576L; private final static String TPL_FILE = "queryCert.template"; - private final static String INFO = "ListCerts"; private final static BigInteger MINUS_ONE = new BigInteger("-1"); - private final static String CURRENT_TIME = "currentTime"; private final static String USE_CLIENT_FILTER = "useClientFilter"; private final static String ALLOWED_CLIENT_FILTERS = "allowedClientFilters"; @@ -82,7 +80,7 @@ public class ListCerts extends CMSServlet { private boolean mHardJumpTo = false; //jump to the end private String mDirection = null; private boolean mUseClientFilter = false; - private Vector mAllowedClientFilters = new Vector(); + private Vector<String> mAllowedClientFilters = new Vector<String>(); private int mMaxReturns = 2000; /** @@ -149,18 +147,18 @@ public class ListCerts extends CMSServlet { if (mUseClientFilter) { com.netscape.certsrv.apps.CMS.debug("useClientFilter=true"); - Enumeration filters = mAllowedClientFilters.elements(); + Enumeration<String> filters = mAllowedClientFilters.elements(); // check to see if the filter is allowed while (filters.hasMoreElements()) { String filter = (String) filters.nextElement(); - com.netscape.certsrv.apps.CMS.debug("Comparing filter=" + filter + " queryCertFilter=" - + queryCertFilter); + com.netscape.certsrv.apps.CMS.debug("Comparing filter=" + + filter + " queryCertFilter=" + queryCertFilter); if (filter.equals(queryCertFilter)) { return queryCertFilter; } } - com.netscape.certsrv.apps.CMS.debug("Requested filter '" + queryCertFilter - + "' is not allowed. Please check the " + ALLOWED_CLIENT_FILTERS + "parameter"); + com.netscape.certsrv.apps.CMS.debug("Requested filter '" + + queryCertFilter + "' is not allowed. Please check the " + ALLOWED_CLIENT_FILTERS + "parameter"); return null; } else { com.netscape.certsrv.apps.CMS.debug("useClientFilter=false"); @@ -320,8 +318,9 @@ public class ListCerts extends CMSServlet { } catch (NumberFormatException e) { log(ILogger.LL_FAILURE, com.netscape.certsrv.apps.CMS.getLogMessage("BASE_INVALID_NUMBER_FORMAT")); - error = new EBaseException(com.netscape.certsrv.apps.CMS.getUserMessage(getLocale(req), - "CMS_BASE_INVALID_NUMBER_FORMAT")); + error = + new EBaseException(com.netscape.certsrv.apps.CMS.getUserMessage(getLocale(req), + "CMS_BASE_INVALID_NUMBER_FORMAT")); } catch (EBaseException e) { error = e; } @@ -395,7 +394,7 @@ public class ListCerts extends CMSServlet { pSize); // retrive maxCount + 1 entries - Enumeration e = list.getCertRecords(0, maxCount); + Enumeration<ICertRecord> e = list.getCertRecords(0, maxCount); ICertRecordList tolist = null; int toCurIndex = 0; @@ -407,7 +406,7 @@ public class ListCerts extends CMSServlet { filter, (String[]) null, serialTo, "serialno", maxCount); - Enumeration en = tolist.getCertRecords(0, 0); + Enumeration<ICertRecord> en = tolist.getCertRecords(0, 0); if (en == null || (!en.hasMoreElements())) { toCurIndex = list.getSize() - 1; @@ -654,7 +653,7 @@ public class ListCerts extends CMSServlet { CRLExtensions crlExts = revocationInfo.getCRLEntryExtensions(); if (crlExts != null) { - Enumeration enum1 = crlExts.getElements(); + Enumeration<Extension> enum1 = crlExts.getElements(); int reason = 0; while (enum1.hasMoreElements()) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/SrchCerts.java b/pki/base/common/src/com/netscape/cms/servlet/cert/SrchCerts.java index bbe8a479e..8e6d58216 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/SrchCerts.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/SrchCerts.java @@ -608,14 +608,14 @@ public class SrchCerts extends CMSServlet { CMS.debug("Resetting timelimit from " + timeLimit + " to " + mTimeLimits); timeLimit = mTimeLimits; } - CMS.debug("Start searching ... " + "filter=" + filter + " maxreturns=" + maxResults + " timelimit=" - + timeLimit); - Enumeration e = mCertDB.searchCertificates(filter, maxResults, timeLimit); + CMS.debug("Start searching ... " + + "filter=" + filter + " maxreturns=" + maxResults + " timelimit=" + timeLimit); + Enumeration<ICertRecord> e = mCertDB.searchCertificates(filter, maxResults, timeLimit); int count = 0; while (e != null && e.hasMoreElements()) { - ICertRecord rec = (ICertRecord) e.nextElement(); + ICertRecord rec = e.nextElement(); if (rec != null) { count++; @@ -744,11 +744,11 @@ public class SrchCerts extends CMSServlet { CRLExtensions crlExts = revocationInfo.getCRLEntryExtensions(); if (crlExts != null) { - Enumeration enum1 = crlExts.getElements(); + Enumeration<Extension> enum1 = crlExts.getElements(); int reason = 0; while (enum1.hasMoreElements()) { - Extension ext = (Extension) enum1.nextElement(); + Extension ext = enum1.nextElement(); if (ext instanceof CRLReasonExtension) { reason = ((CRLReasonExtension) ext).getReason().toInt(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/UpdateCRL.java b/pki/base/common/src/com/netscape/cms/servlet/cert/UpdateCRL.java index 9d3e633d2..680886b95 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/UpdateCRL.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/UpdateCRL.java @@ -50,6 +50,7 @@ import com.netscape.certsrv.ca.ICertificateAuthority; import com.netscape.certsrv.ldap.ELdapException; import com.netscape.certsrv.logging.AuditFormat; import com.netscape.certsrv.logging.ILogger; +import com.netscape.certsrv.publish.ILdapRule; import com.netscape.certsrv.publish.IPublisherProcessor; import com.netscape.certsrv.util.IStatsSubsystem; import com.netscape.cms.servlet.base.CMSServlet; @@ -72,7 +73,7 @@ public class UpdateCRL extends CMSServlet { private final static String INFO = "UpdateCRL"; private final static String TPL_FILE = "updateCRL.template"; - private static Vector mTesting = new Vector(); + private static Vector<String> mTesting = new Vector<String>(); private String mFormPath = null; private ICertificateAuthority mCA = null; @@ -278,7 +279,7 @@ public class UpdateCRL extends CMSServlet { rarg.addStringValue("crlSizes", crlSizes); StringBuffer crlSplits = new StringBuffer(); - Vector splits = crlIssuingPoint.getSplitTimes(); + Vector<Long> splits = crlIssuingPoint.getSplitTimes(); for (int i = 0; i < splits.size(); i++) { crlSplits.append(splits.elementAt(i)); if (i + 1 < splits.size()) @@ -311,10 +312,10 @@ public class UpdateCRL extends CMSServlet { String results = req.getParameter("results"); if (crlIssuingPointId != null) { - Enumeration ips = mCA.getCRLIssuingPoints(); + Enumeration<ICRLIssuingPoint> ips = mCA.getCRLIssuingPoints(); while (ips.hasMoreElements()) { - ICRLIssuingPoint ip = (ICRLIssuingPoint) ips.nextElement(); + ICRLIssuingPoint ip = ips.nextElement(); if (crlIssuingPointId.equals(ip.getId())) { break; @@ -447,7 +448,7 @@ public class UpdateCRL extends CMSServlet { } if (lpm != null && lpm.enabled()) { - Enumeration rules = lpm.getRules(IPublisherProcessor.PROP_LOCAL_CRL); + Enumeration<ILdapRule> rules = lpm.getRules(IPublisherProcessor.PROP_LOCAL_CRL); if (rules != null && rules.hasMoreElements()) { if (publishError != null) { header.addStringValue("crlPublished", "Failure"); @@ -481,8 +482,8 @@ public class UpdateCRL extends CMSServlet { crlIssuingPoint.getCRLNumber(), crlIssuingPoint.getLastUpdate(), crlIssuingPoint.getNextUpdate(), - Long.toString(crlIssuingPoint.getCRLSize()) + " time: " - + (endTime - startTime) } + Long.toString(crlIssuingPoint.getCRLSize()) + + " time: " + (endTime - startTime) } ); } else { mLogger.log(ILogger.EV_AUDIT, ILogger.S_OTHER, @@ -496,8 +497,8 @@ public class UpdateCRL extends CMSServlet { crlIssuingPoint.getCRLNumber(), crlIssuingPoint.getLastUpdate(), "not set", - Long.toString(crlIssuingPoint.getCRLSize()) + " time: " - + (endTime - startTime) } + Long.toString(crlIssuingPoint.getCRLSize()) + + " time: " + (endTime - startTime) } ); } } catch (EBaseException e) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/scep/CRSEnrollment.java b/pki/base/common/src/com/netscape/cms/servlet/cert/scep/CRSEnrollment.java index 75ec99e13..23793b3f9 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/scep/CRSEnrollment.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/scep/CRSEnrollment.java @@ -206,9 +206,10 @@ public class CRSEnrollment extends HttpServlet { public CRSEnrollment() { } - public static Hashtable toHashtable(HttpServletRequest req) { - Hashtable httpReqHash = new Hashtable(); - Enumeration names = req.getParameterNames(); + public static Hashtable<String, String> toHashtable(HttpServletRequest req) { + Hashtable<String, String> httpReqHash = new Hashtable<String, String>(); + @SuppressWarnings("unchecked") + Enumeration<String> names = req.getParameterNames(); while (names.hasMoreElements()) { String name = (String) names.nextElement(); httpReqHash.put(name, req.getParameter(name)); @@ -416,7 +417,7 @@ public class CRSEnrollment extends HttpServlet { HttpServletRequest request) throws EBaseException { // build credential - Enumeration authNames = authenticator.getValueNames(); + Enumeration<String> authNames = authenticator.getValueNames(); if (authNames != null) { while (authNames.hasMoreElements()) { @@ -536,7 +537,7 @@ public class CRSEnrollment extends HttpServlet { public String getPasswordFromP10(PKCS10 p10) { PKCS10Attributes p10atts = p10.getAttributes(); - Enumeration e = p10atts.getElements(); + Enumeration<PKCS10Attribute> e = p10atts.getElements(); try { while (e.hasMoreElements()) { @@ -688,7 +689,7 @@ public class CRSEnrollment extends HttpServlet { String pkcs10Attr = ""; PKCS10Attributes p10atts = p10.getAttributes(); - Enumeration e = p10atts.getElements(); + Enumeration<PKCS10Attribute> e = p10atts.getElements(); while (e.hasMoreElements()) { PKCS10Attribute p10a = (PKCS10Attribute) e.nextElement(); @@ -696,18 +697,21 @@ public class CRSEnrollment extends HttpServlet { if (attr.getName().equals(ChallengePassword.NAME)) { if (attr.get(ChallengePassword.PASSWORD) != null) { - pkcs10Attr = pkcs10Attr + + pkcs10Attr = + pkcs10Attr + + "<ChallengePassword><Password>" - + (String) attr.get(ChallengePassword.PASSWORD) + "</Password></ChallengePassword>"; + + (String) attr.get(ChallengePassword.PASSWORD) + + "</Password></ChallengePassword>"; } } String extensionsStr = ""; if (attr.getName().equals(ExtensionsRequested.NAME)) { - Enumeration exts = ((ExtensionsRequested) attr).getExtensions().elements(); + Enumeration<Extension> exts = ((ExtensionsRequested) attr).getExtensions().elements(); while (exts.hasMoreElements()) { - Extension ext = (Extension) exts.nextElement(); + Extension ext = exts.nextElement(); if (ext.getExtensionId().equals( OIDMap.getOID(SubjectAlternativeNameExtension.IDENT))) { @@ -716,14 +720,16 @@ public class CRSEnrollment extends HttpServlet { Boolean.valueOf(false), // noncritical ext.getExtensionValue()); - Vector v = - (Vector) sane.get(SubjectAlternativeNameExtension.SUBJECT_NAME); + @SuppressWarnings("unchecked") + Vector<GeneralNameInterface> v = + (Vector<GeneralNameInterface>) sane + .get(SubjectAlternativeNameExtension.SUBJECT_NAME); - Enumeration gne = v.elements(); + Enumeration<GeneralNameInterface> gne = v.elements(); StringBuffer subjAltNameStr = new StringBuffer(); while (gne.hasMoreElements()) { - GeneralNameInterface gni = (GeneralNameInterface) gne.nextElement(); + GeneralNameInterface gni = gne.nextElement(); if (gni instanceof GeneralName) { GeneralName genName = (GeneralName) gni; @@ -974,14 +980,14 @@ public class CRSEnrollment extends HttpServlet { IRequestQueue rq = ca.getRequestQueue(); IRequest foundRequest = null; - Enumeration rids = rq.findRequestsBySourceId(txid); + Enumeration<RequestId> rids = rq.findRequestsBySourceId(txid); if (rids == null) { return null; } int count = 0; while (rids.hasMoreElements()) { - RequestId rid = (RequestId) rids.nextElement(); + RequestId rid = rids.nextElement(); if (rid == null) { continue; } @@ -1151,12 +1157,11 @@ public class CRSEnrollment extends HttpServlet { IRequest issueReq = null; X509CertImpl issuedCert = null; - Vector extensionsRequested = null; SubjectAlternativeNameExtension sane = null; CertAttrSet requested_ext = null; try { - PKCS10 p10 = (PKCS10) req.getP10(); + PKCS10 p10 = req.getP10(); if (p10 == null) { crsResp.setFailInfo(CRSPKIMessage.mFailInfo_badMessageCheck); @@ -1185,10 +1190,10 @@ public class CRSEnrollment extends HttpServlet { // one RDN, with many AVA's to // many RDN's with one AVA in each. - Enumeration rdne = p10subject.getRDNs(); - Vector rdnv = new Vector(); + Enumeration<RDN> rdne = p10subject.getRDNs(); + Vector<RDN> rdnv = new Vector<RDN>(); - Hashtable sanehash = new Hashtable(); + Hashtable<String, String> sanehash = new Hashtable<String, String>(); X500NameAttrMap xnap = X500NameAttrMap.getDefault(); while (rdne.hasMoreElements()) { @@ -1228,7 +1233,7 @@ public class CRSEnrollment extends HttpServlet { kue.set(KeyUsageExtension.KEY_ENCIPHERMENT, Boolean.valueOf(true)); PKCS10Attributes p10atts = p10.getAttributes(); - Enumeration e = p10atts.getElements(); + Enumeration<PKCS10Attribute> e = p10atts.getElements(); while (e.hasMoreElements()) { PKCS10Attribute p10a = (PKCS10Attribute) e.nextElement(); @@ -1246,9 +1251,9 @@ public class CRSEnrollment extends HttpServlet { if (attr.getName().equals(ExtensionsRequested.NAME)) { - Enumeration exts = ((ExtensionsRequested) attr).getExtensions().elements(); + Enumeration<Extension> exts = ((ExtensionsRequested) attr).getExtensions().elements(); while (exts.hasMoreElements()) { - Extension ext = (Extension) exts.nextElement(); + Extension ext = exts.nextElement(); if (ext.getExtensionId().equals( OIDMap.getOID(KeyUsageExtension.IDENT))) { @@ -1265,10 +1270,12 @@ public class CRSEnrollment extends HttpServlet { new Boolean(false), // noncritical ext.getExtensionValue()); - Vector v = - (Vector) sane.get(SubjectAlternativeNameExtension.SUBJECT_NAME); + @SuppressWarnings("unchecked") + Vector<GeneralNameInterface> v = + (Vector<GeneralNameInterface>) sane + .get(SubjectAlternativeNameExtension.SUBJECT_NAME); - Enumeration gne = v.elements(); + Enumeration<GeneralNameInterface> gne = v.elements(); while (gne.hasMoreElements()) { GeneralNameInterface gni = (GeneralNameInterface) gne.nextElement(); @@ -1308,8 +1315,8 @@ public class CRSEnrollment extends HttpServlet { } catch (Exception sne) { log(ILogger.LL_INFO, - "Unable to use appendDN parameter: " + mAppendDN + ". Error is " + sne.getMessage() - + " Using unmodified subjectname"); + "Unable to use appendDN parameter: " + + mAppendDN + ". Error is " + sne.getMessage() + " Using unmodified subjectname"); } if (subject != null) @@ -1350,7 +1357,7 @@ public class CRSEnrollment extends HttpServlet { } // NEED TO FIX } - private SubjectAlternativeNameExtension makeDefaultSubjectAltName(Hashtable ht) { + private SubjectAlternativeNameExtension makeDefaultSubjectAltName(Hashtable<String, String> ht) { // if no subjectaltname extension was requested, we try to make it up // from some of the elements of the subject name @@ -1359,7 +1366,7 @@ public class CRSEnrollment extends HttpServlet { GeneralNameInterface[] gn = new GeneralNameInterface[ht.size()]; itemCount = 0; - Enumeration en = ht.keys(); + Enumeration<String> en = ht.keys(); while (en.hasMoreElements()) { String key = (String) en.nextElement(); if (key.equals(SANE_DNSNAME)) { @@ -1445,15 +1452,15 @@ public class CRSEnrollment extends HttpServlet { return authenticationFailed; } - private boolean areFingerprintsEqual(IRequest req, Hashtable fingerprints) { + private boolean areFingerprintsEqual(IRequest req, Hashtable<String, byte[]> fingerprints) { - Hashtable old_fprints = req.getExtDataInHashtable(IRequest.FINGERPRINTS); + Hashtable<String, String> old_fprints = req.getExtDataInHashtable(IRequest.FINGERPRINTS); if (old_fprints == null) { return false; } - byte[] old_md5 = CMS.AtoB((String) old_fprints.get("MD5")); - byte[] new_md5 = (byte[]) fingerprints.get("MD5"); + byte[] old_md5 = CMS.AtoB(old_fprints.get("MD5")); + byte[] new_md5 = fingerprints.get("MD5"); if (old_md5.length != new_md5.length) return false; @@ -1474,7 +1481,7 @@ public class CRSEnrollment extends HttpServlet { try { unwrapPKCS10(req, cx); - Hashtable fingerprints = makeFingerPrints(req); + Hashtable<String, byte[]> fingerprints = makeFingerPrints(req); if (cmsRequest != null) { if (areFingerprintsEqual(cmsRequest, fingerprints)) { @@ -1562,7 +1569,7 @@ public class CRSEnrollment extends HttpServlet { // use profile framework to handle SCEP if (mProfileId != null) { - PKCS10 pkcs10data = (PKCS10) req.getP10(); + PKCS10 pkcs10data = req.getP10(); String pkcs10blob = CMS.BtoA(pkcs10data.toByteArray()); // XXX authentication handling @@ -1673,10 +1680,10 @@ public class CRSEnrollment extends HttpServlet { } catch (Exception pwex) { } - Hashtable fingerprints = (Hashtable) req.get(IRequest.FINGERPRINTS); + Hashtable<?, ?> fingerprints = (Hashtable<?, ?>) req.get(IRequest.FINGERPRINTS); if (fingerprints.size() > 0) { - Hashtable encodedPrints = new Hashtable(fingerprints.size()); - Enumeration e = fingerprints.keys(); + Hashtable<String, String> encodedPrints = new Hashtable<String, String>(fingerprints.size()); + Enumeration<?> e = fingerprints.keys(); while (e.hasMoreElements()) { String key = (String) e.nextElement(); byte[] value = (byte[]) fingerprints.get(key); @@ -1706,8 +1713,8 @@ public class CRSEnrollment extends HttpServlet { return pkiReq; } - public Hashtable makeFingerPrints(CRSPKIMessage req) { - Hashtable fingerprints = new Hashtable(); + public Hashtable<String, byte[]> makeFingerPrints(CRSPKIMessage req) { + Hashtable<String, byte[]> fingerprints = new Hashtable<String, byte[]>(); MessageDigest md; String[] hashes = new String[] { "MD2", "MD5", "SHA1", "SHA256", "SHA512" }; @@ -1936,7 +1943,7 @@ public class CRSEnrollment extends HttpServlet { private CryptoToken keyStorageToken; private CryptoToken internalKeyStorageToken; private KeyGenerator DESkg; - private Enumeration externalTokens = null; + private Enumeration<?> externalTokens = null; private org.mozilla.jss.crypto.X509Certificate signingCert; private org.mozilla.jss.crypto.PrivateKey signingCertPrivKey; private int signingCertKeySize = 0; @@ -2033,11 +2040,11 @@ public class CRSEnrollment extends HttpServlet { return internalToken; } - public void setExternalTokens(Enumeration tokens) { + public void setExternalTokens(Enumeration<?> tokens) { externalTokens = tokens; } - public Enumeration getExternalTokens() { + public Enumeration<?> getExternalTokens() { return externalTokens; } diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/scep/ChallengePassword.java b/pki/base/common/src/com/netscape/cms/servlet/cert/scep/ChallengePassword.java index 8a3ddb5d9..ff55dc9ce 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/scep/ChallengePassword.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/scep/ChallengePassword.java @@ -23,7 +23,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.security.cert.CertificateException; import java.util.Enumeration; -import java.util.Hashtable; +import java.util.Vector; import netscape.security.util.DerValue; import netscape.security.x509.CertAttrSet; @@ -127,8 +127,8 @@ public class ChallengePassword implements CertAttrSet { /** * @return an empty set of elements */ - public Enumeration getElements() { - return (new Hashtable()).elements(); + public Enumeration<String> getAttributeNames() { + return (new Vector<String>()).elements(); } /** diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/scep/ExtensionsRequested.java b/pki/base/common/src/com/netscape/cms/servlet/cert/scep/ExtensionsRequested.java index 33c28447f..b3a0f5651 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/scep/ExtensionsRequested.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/scep/ExtensionsRequested.java @@ -23,7 +23,6 @@ import java.io.InputStream; import java.io.OutputStream; import java.security.cert.CertificateException; import java.util.Enumeration; -import java.util.Hashtable; import java.util.Vector; import netscape.security.util.DerInputStream; @@ -41,7 +40,7 @@ public class ExtensionsRequested implements CertAttrSet { private String kue_digital_signature = "false"; private String kue_key_encipherment = "false"; - private Vector exts = new Vector(); + private Vector<Extension> exts = new Vector<Extension>(); public ExtensionsRequested(Object stuff) throws IOException { ByteArrayInputStream is = new ByteArrayInputStream((byte[]) stuff); @@ -85,8 +84,8 @@ public class ExtensionsRequested implements CertAttrSet { throws CertificateException, IOException { } - public Enumeration getElements() { - return (new Hashtable()).elements(); + public Enumeration<String> getAttributeNames() { + return (new Vector<String>()).elements(); } public String getName() { @@ -171,7 +170,7 @@ public class ExtensionsRequested implements CertAttrSet { } - public Vector getExtensions() { + public Vector<Extension> getExtensions() { return exts; } diff --git a/pki/base/common/src/com/netscape/cms/servlet/common/CMCOutputTemplate.java b/pki/base/common/src/com/netscape/cms/servlet/common/CMCOutputTemplate.java index 25f062657..aa95b622d 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/common/CMCOutputTemplate.java +++ b/pki/base/common/src/com/netscape/cms/servlet/common/CMCOutputTemplate.java @@ -778,12 +778,14 @@ public class CMCOutputTemplate { SignedData msgData = (SignedData) msgValue.decodeWith(SignedData.getTemplate()); if (!verifyRevRequestSignature(msgData)) { - OtherInfo otherInfo = new OtherInfo(OtherInfo.FAIL, new INTEGER( - OtherInfo.BAD_MESSAGE_CHECK), null); + OtherInfo otherInfo = + new OtherInfo(OtherInfo.FAIL, new INTEGER(OtherInfo.BAD_MESSAGE_CHECK), + null); SEQUENCE failed_bpids = new SEQUENCE(); failed_bpids.addElement(attrbpid); - cmcStatusInfo = new CMCStatusInfo(CMCStatusInfo.FAILED, failed_bpids, - (String) null, otherInfo); + cmcStatusInfo = + new CMCStatusInfo(CMCStatusInfo.FAILED, failed_bpids, (String) null, + otherInfo); tagattr = new TaggedAttribute( new INTEGER(bpid++), OBJECT_IDENTIFIER.id_cmc_cMCStatusInfo, cmcStatusInfo); @@ -825,8 +827,8 @@ public class CMCOutputTemplate { if (!sharedSecretFound) { CMS.debug("CMCOutputTemplate: class for shared secret was not found."); - OtherInfo otherInfo = new OtherInfo(OtherInfo.FAIL, new INTEGER(OtherInfo.INTERNAL_CA_ERROR), - null); + OtherInfo otherInfo = + new OtherInfo(OtherInfo.FAIL, new INTEGER(OtherInfo.INTERNAL_CA_ERROR), null); SEQUENCE failed_bpids = new SEQUENCE(); failed_bpids.addElement(attrbpid); cmcStatusInfo = new CMCStatusInfo(CMCStatusInfo.FAILED, failed_bpids, (String) null, otherInfo); @@ -845,8 +847,8 @@ public class CMCOutputTemplate { if (sharedSecret == null) { CMS.debug("CMCOutputTemplate: class for shared secret was not found."); - OtherInfo otherInfo = new OtherInfo(OtherInfo.FAIL, new INTEGER(OtherInfo.INTERNAL_CA_ERROR), - null); + OtherInfo otherInfo = + new OtherInfo(OtherInfo.FAIL, new INTEGER(OtherInfo.INTERNAL_CA_ERROR), null); SEQUENCE failed_bpids = new SEQUENCE(); failed_bpids.addElement(attrbpid); cmcStatusInfo = new CMCStatusInfo(CMCStatusInfo.FAILED, failed_bpids, (String) null, otherInfo); @@ -864,8 +866,8 @@ public class CMCOutputTemplate { revoke = true; } else { CMS.debug("CMCOutputTemplate: Both client and server shared secret are not the same, cant revoke certificate."); - OtherInfo otherInfo = new OtherInfo(OtherInfo.FAIL, new INTEGER(OtherInfo.BAD_MESSAGE_CHECK), - null); + OtherInfo otherInfo = + new OtherInfo(OtherInfo.FAIL, new INTEGER(OtherInfo.BAD_MESSAGE_CHECK), null); SEQUENCE failed_bpids = new SEQUENCE(); failed_bpids.addElement(attrbpid); cmcStatusInfo = new CMCStatusInfo(CMCStatusInfo.FAILED, failed_bpids, (String) null, otherInfo); @@ -929,8 +931,8 @@ public class CMCOutputTemplate { entryExtn.set(crlReasonExtn.getName(), crlReasonExtn); } - RevokedCertImpl revCertImpl = new RevokedCertImpl(impl.getSerialNumber(), CMS.getCurrentDate(), - entryExtn); + RevokedCertImpl revCertImpl = + new RevokedCertImpl(impl.getSerialNumber(), CMS.getCurrentDate(), entryExtn); RevokedCertImpl[] revCertImpls = new RevokedCertImpl[1]; revCertImpls[0] = revCertImpl; IRequestQueue queue = ca.getRequestQueue(); @@ -950,12 +952,12 @@ public class CMCOutputTemplate { if (result.equals(IRequest.RES_ERROR)) { CMS.debug("CMCOutputTemplate: revReq exception: " + revReq.getExtDataInString(IRequest.ERROR)); - OtherInfo otherInfo = new OtherInfo(OtherInfo.FAIL, new INTEGER(OtherInfo.BAD_REQUEST), - null); + OtherInfo otherInfo = + new OtherInfo(OtherInfo.FAIL, new INTEGER(OtherInfo.BAD_REQUEST), null); SEQUENCE failed_bpids = new SEQUENCE(); failed_bpids.addElement(attrbpid); - cmcStatusInfo = new CMCStatusInfo(CMCStatusInfo.FAILED, failed_bpids, (String) null, - otherInfo); + cmcStatusInfo = + new CMCStatusInfo(CMCStatusInfo.FAILED, failed_bpids, (String) null, otherInfo); tagattr = new TaggedAttribute( new INTEGER(bpid++), OBJECT_IDENTIFIER.id_cmc_cMCStatusInfo, cmcStatusInfo); @@ -1039,7 +1041,7 @@ public class CMCOutputTemplate { SET dias = msgData.getDigestAlgorithmIdentifiers(); int numDig = dias.size(); - Hashtable digs = new Hashtable(); + Hashtable<String, byte[]> digs = new Hashtable<String, byte[]>(); for (int i = 0; i < numDig; i++) { AlgorithmIdentifier dai = (AlgorithmIdentifier) dias.elementAt(i); @@ -1057,7 +1059,7 @@ public class CMCOutputTemplate { org.mozilla.jss.pkix.cms.SignerInfo si = (org.mozilla.jss.pkix.cms.SignerInfo) sis.elementAt(i); String name = si.getDigestAlgorithm().toString(); - byte[] digest = (byte[]) digs.get(name); + byte[] digest = digs.get(name); if (digest == null) { MessageDigest md = MessageDigest.getInstance(name); ByteArrayOutputStream ostream = new ByteArrayOutputStream(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/connector/ConnectorServlet.java b/pki/base/common/src/com/netscape/cms/servlet/connector/ConnectorServlet.java index ca7759d5a..b2c43b3f7 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/connector/ConnectorServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/connector/ConnectorServlet.java @@ -833,10 +833,10 @@ public class ConnectorServlet extends CMSServlet { int reason = 0; if (crlExts != null) { - Enumeration enum1 = crlExts.getElements(); + Enumeration<Extension> enum1 = crlExts.getElements(); while (enum1.hasMoreElements()) { - Extension ext = (Extension) enum1.nextElement(); + Extension ext = enum1.nextElement(); if (ext instanceof CRLReasonExtension) { reason = ((CRLReasonExtension) ext).getReason().toInt(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/AdminAuthenticatePanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/AdminAuthenticatePanel.java index 16c5e6c65..8c84f4a21 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/AdminAuthenticatePanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/AdminAuthenticatePanel.java @@ -249,12 +249,13 @@ public class AdminAuthenticatePanel extends WizardPanelBase { c1.append(",preop.ca.hostname,preop.ca.httpport,preop.ca.httpsport,preop.ca.list,preop.ca.pkcs7,preop.ca.type"); } - String content = "uid=" - + uid - + "&pwd=" - + pwd - + "&op=get&names=cloning.module.token,instanceId,internaldb.basedn,internaldb.ldapauth.password,internaldb.replication.password,internaldb.ldapconn.host,internaldb.ldapconn.port,internaldb.ldapauth.bindDN" - + c1.toString() + "&substores=" + s1.toString(); + String content = + "uid=" + + uid + + "&pwd=" + + pwd + + "&op=get&names=cloning.module.token,instanceId,internaldb.basedn,internaldb.ldapauth.password,internaldb.replication.password,internaldb.ldapconn.host,internaldb.ldapconn.port,internaldb.ldapauth.bindDN" + + c1.toString() + "&substores=" + s1.toString(); boolean success = updateConfigEntries(host, httpsport, true, "/" + cstype + "/admin/" + cstype + "/getConfigEntries", content, config, diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/AdminPanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/AdminPanel.java index d8d841e39..223801d8f 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/AdminPanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/AdminPanel.java @@ -481,8 +481,10 @@ public class AdminPanel extends WizardPanelBase { String session_id = CMS.getConfigSDSessionId(); String subjectDN = HttpInput.getString(request, "subject"); - String content = "profileId=" + profileId + "&cert_request_type=" + cert_request_type + "&cert_request=" - + cert_request + "&xmlOutput=true&sessionID=" + session_id + "&subject=" + subjectDN; + String content = + "profileId=" + + profileId + "&cert_request_type=" + cert_request_type + "&cert_request=" + cert_request + + "&xmlOutput=true&sessionID=" + session_id + "&subject=" + subjectDN; HttpClient httpclient = new HttpClient(); String c = null; @@ -651,7 +653,8 @@ public class AdminPanel extends WizardPanelBase { } catch (Exception e) { } if (ca == null && type.equals("otherca")) { - info = "Since you do not join the Redhat CA network, the administrator's certificate will not be generated automatically."; + info = + "Since you do not join the Redhat CA network, the administrator's certificate will not be generated automatically."; } context.put("info", info); context.put("admin_email", request.getParameter("email")); diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/CertRequestPanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/CertRequestPanel.java index f73e44c18..c81c666e6 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/CertRequestPanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/CertRequestPanel.java @@ -128,8 +128,8 @@ public class CertRequestPanel extends WizardPanelBase { if (hardware) { CMS.debug("CertRequestPanel findCertificate: The certificate with the same nickname: " + fullnickname + " has been found on HSM. Please remove it before proceeding."); - throw new IOException("The certificate with the same nickname: " + fullnickname - + " has been found on HSM. Please remove it before proceeding."); + throw new IOException("The certificate with the same nickname: " + + fullnickname + " has been found on HSM. Please remove it before proceeding."); } return true; } @@ -212,8 +212,8 @@ public class CertRequestPanel extends WizardPanelBase { CMS.debug("CertRequestPanel cleanup: deleting certificate (" + nickname + ")."); deleteCert(tokenname, nickname); } catch (Exception e) { - CMS.debug("CertRequestPanel cleanup: failed to delete certificate (" + nickname + "). Exception: " - + e.toString()); + CMS.debug("CertRequestPanel cleanup: failed to delete certificate (" + + nickname + "). Exception: " + e.toString()); } } } @@ -735,8 +735,8 @@ public class CertRequestPanel extends WizardPanelBase { ic.setSSLTrust(InternalCertificate.USER); ic.setEmailTrust(InternalCertificate.USER); if (tag.equals("audit_signing")) { - ic.setObjectSigningTrust(InternalCertificate.USER | InternalCertificate.VALID_PEER - | InternalCertificate.TRUSTED_PEER); + ic.setObjectSigningTrust(InternalCertificate.USER + | InternalCertificate.VALID_PEER | InternalCertificate.TRUSTED_PEER); } else { ic.setObjectSigningTrust(InternalCertificate.USER); } diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/CertUtil.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/CertUtil.java index 5e1bd5e80..2934b3ebe 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/CertUtil.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/CertUtil.java @@ -643,8 +643,8 @@ public class CertUtil { try { privKey = cm.findPrivKeyByCert(cert); } catch (Exception e) { - CMS.debug("CertUtil privateKeyExistsOnToken: cant find private key (" + fullnickname + ") exception: " - + e.toString()); + CMS.debug("CertUtil privateKeyExistsOnToken: cant find private key (" + + fullnickname + ") exception: " + e.toString()); return false; } diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/DatabasePanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/DatabasePanel.java index bd3a31770..02a992832 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/DatabasePanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/DatabasePanel.java @@ -1035,8 +1035,8 @@ public class DatabasePanel extends WizardPanelBase { // setup replication after indexes have been created if (select.equals("clone")) { CMS.debug("Start setting up replication."); - setupReplication(request, context, (secure.equals("on") ? "true" : "false"), - (cloneStartTLS.equals("on") ? "true" : "false")); + setupReplication(request, context, (secure.equals("on") ? "true" : "false"), (cloneStartTLS.equals("on") + ? "true" : "false")); CMS.debug("Finish setting up replication."); try { @@ -1318,8 +1318,8 @@ public class DatabasePanel extends WizardPanelBase { } return id; } else { - CMS.debug("DatabasePanel enableReplication: Failed to create " + replicadn + " entry. Exception: " - + e.toString()); + CMS.debug("DatabasePanel enableReplication: Failed to create " + + replicadn + " entry. Exception: " + e.toString()); return id; } } @@ -1378,8 +1378,8 @@ public class DatabasePanel extends WizardPanelBase { throw ee; } } else { - CMS.debug("DatabasePanel createReplicationAgreement: Failed to create " + dn + " entry. Exception: " - + e.toString()); + CMS.debug("DatabasePanel createReplicationAgreement: Failed to create " + + dn + " entry. Exception: " + e.toString()); throw e; } } @@ -1391,8 +1391,8 @@ public class DatabasePanel extends WizardPanelBase { String name) { String dn = "cn=" + name + "," + replicadn; CMS.debug("DatabasePanel initializeConsumer: initializeConsumer dn: " + dn); - CMS.debug("DatabasePanel initializeConsumer: initializeConsumer host: " + conn.getHost() + " port: " - + conn.getPort()); + CMS.debug("DatabasePanel initializeConsumer: initializeConsumer host: " + + conn.getHost() + " port: " + conn.getPort()); try { LDAPAttribute attr = new LDAPAttribute("nsds5beginreplicarefresh", "start"); @@ -1487,9 +1487,9 @@ public class DatabasePanel extends WizardPanelBase { try { String filter = "(objectclass=*)"; String[] attrs = { "nsslapd-directory" }; - LDAPSearchResults results = conn.search("cn=config,cn=ldbm database,cn=plugins,cn=config", - LDAPv3.SCOPE_SUB, - filter, attrs, false); + LDAPSearchResults results = + conn.search("cn=config,cn=ldbm database,cn=plugins,cn=config", LDAPv3.SCOPE_SUB, + filter, attrs, false); while (results.hasMoreElements()) { LDAPEntry entry = results.next(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/DisplayCertChainPanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/DisplayCertChainPanel.java index c24992cb4..2f5831794 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/DisplayCertChainPanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/DisplayCertChainPanel.java @@ -195,11 +195,14 @@ public class DisplayCertChainPanel extends WizardPanelBase { String cs_hostname = cs.getString("machineName", ""); int cs_port = cs.getInteger("pkicreate.admin_secure_port", -1); String subsystem = cs.getString("cs.type", ""); - String urlVal = "https://" + cs_hostname + ":" + cs_port + "/" + toLowerCaseSubsystemType(subsystem) - + "/admin/console/config/wizard?p=" + panel + "&subsystem=" + subsystem; + String urlVal = + "https://" + + cs_hostname + ":" + cs_port + "/" + toLowerCaseSubsystemType(subsystem) + + "/admin/console/config/wizard?p=" + panel + "&subsystem=" + subsystem; String encodedValue = URLEncoder.encode(urlVal, "UTF-8"); - String sdurl = "https://" + sd_hostname + ":" + sd_port + "/ca/admin/ca/securityDomainLogin?url=" - + encodedValue; + String sdurl = + "https://" + + sd_hostname + ":" + sd_port + "/ca/admin/ca/securityDomainLogin?url=" + encodedValue; response.sendRedirect(sdurl); // The user previously specified the CA Security Domain's diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/DonePanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/DonePanel.java index 388570531..ffadf5884 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/DonePanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/DonePanel.java @@ -495,14 +495,14 @@ public class DonePanel extends WizardPanelBase { } else { serialdn = "ou=keyRepository,ou=" + type.toLowerCase() + "," + basedn; } - LDAPAttribute attrSerialNextRange = new LDAPAttribute("nextRange", endSerialNum.add(oneNum) - .toString()); + LDAPAttribute attrSerialNextRange = + new LDAPAttribute("nextRange", endSerialNum.add(oneNum).toString()); LDAPModification serialmod = new LDAPModification(LDAPModification.REPLACE, attrSerialNextRange); conn.modify(serialdn, serialmod); String requestdn = "ou=" + type.toLowerCase() + ",ou=requests," + basedn; - LDAPAttribute attrRequestNextRange = new LDAPAttribute("nextRange", endRequestNum.add(oneNum) - .toString()); + LDAPAttribute attrRequestNextRange = + new LDAPAttribute("nextRange", endRequestNum.add(oneNum).toString()); LDAPModification requestmod = new LDAPModification(LDAPModification.REPLACE, attrRequestNextRange); conn.modify(requestdn, requestmod); @@ -777,12 +777,15 @@ public class DonePanel extends WizardPanelBase { } else { CMS.debug("DonePanel: Transport certificate is being setup in " + url); String session_id = CMS.getConfigSDSessionId(); - String content = "ca.connector.KRA.enable=true&ca.connector.KRA.local=false&ca.connector.KRA.timeout=30&ca.connector.KRA.uri=/kra/agent/kra/connector&ca.connector.KRA.host=" - + ownagenthost - + "&ca.connector.KRA.port=" - + ownagentsport - + "&ca.connector.KRA.transportCert=" - + URLEncoder.encode(transportCert) + "&sessionID=" + session_id; + String content = + "ca.connector.KRA.enable=true&ca.connector.KRA.local=false&ca.connector.KRA.timeout=30&ca.connector.KRA.uri=/kra/agent/kra/connector&ca.connector.KRA.host=" + + ownagenthost + + "&ca.connector.KRA.port=" + + ownagentsport + + "&ca.connector.KRA.transportCert=" + + URLEncoder.encode(transportCert) + + "&sessionID=" + + session_id; updateConnectorInfo(host, port, true, content); } diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/NamePanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/NamePanel.java index 4f6df0f0b..9e0ca6f38 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/NamePanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/NamePanel.java @@ -491,9 +491,11 @@ public class NamePanel extends WizardPanelBase { String machineName = config.getString("machineName", ""); String securePort = config.getString("service.securePort", ""); if (certTag.equals("subsystem")) { - String content = "requestor_name=" + sysType + "-" + machineName + "-" + securePort + "&profileId=" - + profileId + "&cert_request_type=pkcs10&cert_request=" - + URLEncoder.encode(pkcs10, "UTF-8") + "&xmlOutput=true&sessionID=" + session_id; + String content = + "requestor_name=" + + sysType + "-" + machineName + "-" + securePort + "&profileId=" + profileId + + "&cert_request_type=pkcs10&cert_request=" + URLEncoder.encode(pkcs10, "UTF-8") + + "&xmlOutput=true&sessionID=" + session_id; cert = CertUtil.createRemoteCert(sd_hostname, sd_ee_port, content, response, this); if (cert == null) { @@ -508,9 +510,11 @@ public class NamePanel extends WizardPanelBase { } catch (Exception ee) { } - String content = "requestor_name=" + sysType + "-" + machineName + "-" + securePort + "&profileId=" - + profileId + "&cert_request_type=pkcs10&cert_request=" - + URLEncoder.encode(pkcs10, "UTF-8") + "&xmlOutput=true&sessionID=" + session_id; + String content = + "requestor_name=" + + sysType + "-" + machineName + "-" + securePort + "&profileId=" + profileId + + "&cert_request_type=pkcs10&cert_request=" + URLEncoder.encode(pkcs10, "UTF-8") + + "&xmlOutput=true&sessionID=" + session_id; cert = CertUtil.createRemoteCert(ca_hostname, ca_port, content, response, this); if (cert == null) { @@ -651,8 +655,8 @@ public class NamePanel extends WizardPanelBase { config.commit(false); } } catch (Exception e) { - CMS.debug("NamePanel: configCertWithTag: Exception in setting nickname for " + ct + ": " - + e.toString()); + CMS.debug("NamePanel: configCertWithTag: Exception in setting nickname for " + + ct + ": " + e.toString()); } configCert(request, response, context, cert); diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/RestoreKeyCertPanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/RestoreKeyCertPanel.java index dde150485..0ae550707 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/RestoreKeyCertPanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/RestoreKeyCertPanel.java @@ -456,8 +456,13 @@ public class RestoreKeyCertPanel extends WizardPanelBase { s1.append("ca.connector.KRA"); } - content = "op=get&names=cloning.token,instanceId,internaldb.basedn,internaldb.ldapauth.password,internaldb.replication.password,internaldb.ldapconn.host,internaldb.ldapconn.port,internaldb.ldapauth.bindDN" - + c1.toString() + "&substores=" + s1.toString() + "&xmlOutput=true&sessionID=" + session_id; + content = + "op=get&names=cloning.token,instanceId,internaldb.basedn,internaldb.ldapauth.password,internaldb.replication.password,internaldb.ldapconn.host,internaldb.ldapconn.port,internaldb.ldapauth.bindDN" + + c1.toString() + + "&substores=" + + s1.toString() + + "&xmlOutput=true&sessionID=" + + session_id; boolean success = updateConfigEntries(master_hostname, master_port, true, "/" + cstype + "/admin/" + cstype + "/getConfigEntries", content, config, response); if (!success) { @@ -562,8 +567,8 @@ public class RestoreKeyCertPanel extends WizardPanelBase { KeyWrapper wrapper = token.getKeyWrapper(KeyWrapAlgorithm.DES3_CBC_PAD); wrapper.initUnwrap(sk, param); - org.mozilla.jss.crypto.PrivateKey pp = wrapper.unwrapPrivate(encpkey, getPrivateKeyType(publickey), - publickey); + org.mozilla.jss.crypto.PrivateKey pp = + wrapper.unwrapPrivate(encpkey, getPrivateKeyType(publickey), publickey); } catch (Exception e) { CMS.debug("RestoreKeyCertPanel importkeycert: Exception=" + e.toString()); @@ -604,8 +609,8 @@ public class RestoreKeyCertPanel extends WizardPanelBase { | InternalCertificate.VALID_CA); } else if (name.startsWith("auditSigningCert")) { InternalCertificate icert = (InternalCertificate) xcert; - icert.setObjectSigningTrust(InternalCertificate.USER | InternalCertificate.VALID_PEER - | InternalCertificate.TRUSTED_PEER); + icert.setObjectSigningTrust(InternalCertificate.USER + | InternalCertificate.VALID_PEER | InternalCertificate.TRUSTED_PEER); } } else cm.importCACertPackage(cert); diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/SizePanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/SizePanel.java index c4329bda2..fcb88c917 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/SizePanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/SizePanel.java @@ -70,11 +70,12 @@ public class SizePanel extends WizardPanelBase { public PropertySet getUsage() { PropertySet set = new PropertySet(); - Descriptor choiceDesc = new Descriptor( - IDescriptor.CHOICE, - "default,custom", - null, /* no default parameter */ - "If 'default', the key size will be configured automatically. If 'custom', the key size will be set to the value of the parameter 'custom_size'."); + Descriptor choiceDesc = + new Descriptor( + IDescriptor.CHOICE, + "default,custom", + null, /* no default parameter */ + "If 'default', the key size will be configured automatically. If 'custom', the key size will be set to the value of the parameter 'custom_size'."); set.add("choice", choiceDesc); @@ -625,8 +626,9 @@ public class SizePanel extends WizardPanelBase { s = config.getString("preop.ecc.algorithm.list", "SHA256withEC,SHA1withEC,SHA384withEC,SHA512withEC"); context.put("ecclist", s); - s = config.getString("preop.rsa.algorithm.list", - "SHA256withRSA,SHA1withRSA,SHA512withRSA,MD5withRSA,MD2withRSA"); + s = + config.getString("preop.rsa.algorithm.list", + "SHA256withRSA,SHA1withRSA,SHA512withRSA,MD5withRSA,MD2withRSA"); context.put("rsalist", s); s = config.getString("keys.ecc.curve.list", "nistp256"); diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/WizardPanelBase.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/WizardPanelBase.java index 7b381383b..93893bff1 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/WizardPanelBase.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/WizardPanelBase.java @@ -1630,8 +1630,10 @@ public class WizardPanelBase implements IWizardPanel { int cs_port = cs.getInteger("pkicreate.admin_secure_port", -1); int panel = getPanelNo(); String subsystem = cs.getString("cs.type", ""); - String urlVal = "https://" + cs_hostname + ":" + cs_port + "/" + toLowerCaseSubsystemType(subsystem) - + "/admin/console/config/wizard?p=" + panel + "&subsystem=" + subsystem; + String urlVal = + "https://" + + cs_hostname + ":" + cs_port + "/" + toLowerCaseSubsystemType(subsystem) + + "/admin/console/config/wizard?p=" + panel + "&subsystem=" + subsystem; String encodedValue = URLEncoder.encode(urlVal, "UTF-8"); String sdurl = "https://" + hostname + ":" + port + "/ca/admin/ca/securityDomainLogin?url=" + encodedValue; response.sendRedirect(sdurl); diff --git a/pki/base/common/src/com/netscape/cms/servlet/ocsp/CheckCertServlet.java b/pki/base/common/src/com/netscape/cms/servlet/ocsp/CheckCertServlet.java index 5ccb87125..8d2c5a28b 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/ocsp/CheckCertServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/ocsp/CheckCertServlet.java @@ -192,8 +192,8 @@ public class CheckCertServlet extends CMSServlet { } catch (Exception e) { header.addStringValue(ATTR_STATUS, STATUS_UNKNOWN); } - log(ILogger.EV_AUDIT, AuditFormat.LEVEL, "Checked Certificate Status " + cert.getIssuerDN().getName() + " " - + cert.getSerialNumber().toString()); + log(ILogger.EV_AUDIT, AuditFormat.LEVEL, "Checked Certificate Status " + + cert.getIssuerDN().getName() + " " + cert.getSerialNumber().toString()); try { ServletOutputStream out = resp.getOutputStream(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/ocsp/ListCAServlet.java b/pki/base/common/src/com/netscape/cms/servlet/ocsp/ListCAServlet.java index 6b9d20944..83eaca45f 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/ocsp/ListCAServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/ocsp/ListCAServlet.java @@ -128,7 +128,7 @@ public class ListCAServlet extends CMSServlet { CMSTemplateParams argSet = new CMSTemplateParams(header, fixed); IDefStore defStore = mOCSPAuthority.getDefaultStore(); - Enumeration recs = defStore.searchAllCRLIssuingPointRecord(100); + Enumeration<Object> recs = defStore.searchAllCRLIssuingPointRecord(100); // show the current CRL number if present header.addStringValue("stateCount", diff --git a/pki/base/common/src/com/netscape/cms/servlet/processors/CMCProcessor.java b/pki/base/common/src/com/netscape/cms/servlet/processors/CMCProcessor.java index 81d34a65d..51655f973 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/processors/CMCProcessor.java +++ b/pki/base/common/src/com/netscape/cms/servlet/processors/CMCProcessor.java @@ -305,8 +305,9 @@ public class CMCProcessor extends PKIProcessor { PublicKey signKey = null; while (signKey == null && j < numReqs) { - X509Key subjectKeyInfo = (X509Key) ((CertificateX509Key) certInfoArray[j].get(X509CertInfo.KEY)) - .get(CertificateX509Key.KEY); + X509Key subjectKeyInfo = + (X509Key) ((CertificateX509Key) certInfoArray[j].get(X509CertInfo.KEY)) + .get(CertificateX509Key.KEY); MessageDigest md = MessageDigest.getInstance("SHA-1"); md.update(subjectKeyInfo.getEncoded()); diff --git a/pki/base/common/src/com/netscape/cms/servlet/processors/CRMFProcessor.java b/pki/base/common/src/com/netscape/cms/servlet/processors/CRMFProcessor.java index 094ea263c..641017cc8 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/processors/CRMFProcessor.java +++ b/pki/base/common/src/com/netscape/cms/servlet/processors/CRMFProcessor.java @@ -196,8 +196,8 @@ public class CRMFProcessor extends PKIProcessor { // field suggested notBefore and notAfter in CRMF // Tech Support #383184 if (certTemplate.getNotBefore() != null || certTemplate.getNotAfter() != null) { - CertificateValidity certValidity = new CertificateValidity(certTemplate.getNotBefore(), - certTemplate.getNotAfter()); + CertificateValidity certValidity = + new CertificateValidity(certTemplate.getNotBefore(), certTemplate.getNotAfter()); certInfo.set(X509CertInfo.VALIDITY, certValidity); } diff --git a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileSubmitServlet.java b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileSubmitServlet.java index b90dc97b7..4a7d70cc0 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileSubmitServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileSubmitServlet.java @@ -130,13 +130,13 @@ public class ProfileSubmitServlet extends ProfileServlet { private void setInputsIntoContext(HttpServletRequest request, IProfile profile, IProfileContext ctx) { // passing inputs into context - Enumeration inputIds = profile.getProfileInputIds(); + Enumeration<String> inputIds = profile.getProfileInputIds(); if (inputIds != null) { while (inputIds.hasMoreElements()) { String inputId = (String) inputIds.nextElement(); IProfileInput profileInput = profile.getProfileInput(inputId); - Enumeration inputNames = profileInput.getValueNames(); + Enumeration<String> inputNames = profileInput.getValueNames(); while (inputNames.hasMoreElements()) { String inputName = (String) inputNames.nextElement(); @@ -161,13 +161,13 @@ public class ProfileSubmitServlet extends ProfileServlet { */ private void setInputsIntoContext(IRequest request, IProfile profile, IProfileContext ctx, Locale locale) { // passing inputs into context - Enumeration inputIds = profile.getProfileInputIds(); + Enumeration<String> inputIds = profile.getProfileInputIds(); if (inputIds != null) { while (inputIds.hasMoreElements()) { String inputId = (String) inputIds.nextElement(); IProfileInput profileInput = profile.getProfileInput(inputId); - Enumeration inputNames = profileInput.getValueNames(); + Enumeration<String> inputNames = profileInput.getValueNames(); while (inputNames.hasMoreElements()) { String inputName = (String) inputNames.nextElement(); @@ -193,7 +193,7 @@ public class ProfileSubmitServlet extends ProfileServlet { private void setCredentialsIntoContext(HttpServletRequest request, IProfileAuthenticator authenticator, IProfileContext ctx) { - Enumeration authIds = authenticator.getValueNames(); + Enumeration<String> authIds = authenticator.getValueNames(); if (authIds != null) { CMS.debug("ProfileSubmitServlet:setCredentialsIntoContext() authNames not null"); @@ -303,7 +303,7 @@ public class ProfileSubmitServlet extends ProfileServlet { AuthCredentials credentials = new AuthCredentials(); // build credential - Enumeration authNames = authenticator.getValueNames(); + Enumeration<String> authNames = authenticator.getValueNames(); if (authNames != null) { while (authNames.hasMoreElements()) { @@ -329,13 +329,13 @@ public class ProfileSubmitServlet extends ProfileServlet { } private void setInputsIntoRequest(HttpServletRequest request, IProfile profile, IRequest req) { - Enumeration inputIds = profile.getProfileInputIds(); + Enumeration<String> inputIds = profile.getProfileInputIds(); if (inputIds != null) { while (inputIds.hasMoreElements()) { String inputId = (String) inputIds.nextElement(); IProfileInput profileInput = profile.getProfileInput(inputId); - Enumeration inputNames = profileInput.getValueNames(); + Enumeration<String> inputNames = profileInput.getValueNames(); if (inputNames != null) { while (inputNames.hasMoreElements()) { @@ -363,13 +363,13 @@ public class ProfileSubmitServlet extends ProfileServlet { */ private void setInputsIntoRequest(IRequest request, IProfile profile, IRequest req, Locale locale) { // passing inputs into request - Enumeration inputIds = profile.getProfileInputIds(); + Enumeration<String> inputIds = profile.getProfileInputIds(); if (inputIds != null) { while (inputIds.hasMoreElements()) { String inputId = (String) inputIds.nextElement(); IProfileInput profileInput = profile.getProfileInput(inputId); - Enumeration inputNames = profileInput.getValueNames(); + Enumeration<String> inputNames = profileInput.getValueNames(); while (inputNames.hasMoreElements()) { String inputName = (String) inputNames.nextElement(); @@ -394,14 +394,14 @@ public class ProfileSubmitServlet extends ProfileServlet { } private void setOutputIntoArgs(IProfile profile, ArgList outputlist, Locale locale, IRequest req) { - Enumeration outputIds = profile.getProfileOutputIds(); + Enumeration<String> outputIds = profile.getProfileOutputIds(); if (outputIds != null) { while (outputIds.hasMoreElements()) { String outputId = (String) outputIds.nextElement(); IProfileOutput profileOutput = profile.getProfileOutput(outputId); - Enumeration outputNames = profileOutput.getValueNames(); + Enumeration<String> outputNames = profileOutput.getValueNames(); if (outputNames != null) { while (outputNames.hasMoreElements()) { @@ -483,10 +483,11 @@ public class ProfileSubmitServlet extends ProfileServlet { if (CMS.debugOn()) { CMS.debug("Start of ProfileSubmitServlet Input Parameters"); - Enumeration paramNames = request.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> paramNames = request.getParameterNames(); while (paramNames.hasMoreElements()) { - String paramName = (String) paramNames.nextElement(); + String paramName = paramNames.nextElement(); // added this facility so that password can be hidden, // all sensitive parameters should be prefixed with // __ (double underscores); however, in the event that @@ -749,7 +750,7 @@ public class ProfileSubmitServlet extends ProfileServlet { if (origReq != null) { CMS.debug("ProfileSubmitServlet: renewal: found original enrollment request id:" + rid); // debug: print the extData keys - Enumeration en = origReq.getExtDataKeys(); + Enumeration<String> en = origReq.getExtDataKeys(); /* CMS.debug("ProfileSubmitServlet: renewal: origRequest extdata key print BEGINS"); while (en.hasMoreElements()) { @@ -973,11 +974,11 @@ public class ProfileSubmitServlet extends ProfileServlet { CMS.debug("ProfileSubmitServlet: authentication required."); String uid_cred = "Unidentified"; String uid_attempted_cred = "Unidentified"; - Enumeration authIds = authenticator.getValueNames(); + Enumeration<String> authIds = authenticator.getValueNames(); //Attempt to possibly fetch attemped uid, may not always be available. if (authIds != null) { while (authIds.hasMoreElements()) { - String authName = (String) authIds.nextElement(); + String authName = authIds.nextElement(); String value = request.getParameter(authName); if (value != null) { if (authName.equals("uid")) { @@ -1156,9 +1157,9 @@ public class ProfileSubmitServlet extends ProfileServlet { // serial auth token into request if (authToken != null) { - Enumeration tokenNames = authToken.getElements(); + Enumeration<String> tokenNames = authToken.getElements(); while (tokenNames.hasMoreElements()) { - String tokenName = (String) tokenNames.nextElement(); + String tokenName = tokenNames.nextElement(); String[] tokenVals = authToken.getInStringArray(tokenName); if (tokenVals != null) { for (int i = 0; i < tokenVals.length; i++) { @@ -1286,9 +1287,9 @@ public class ProfileSubmitServlet extends ProfileServlet { // print request debug if (reqs[k] != null) { requestIds += " " + reqs[k].getRequestId().toString(); - Enumeration reqKeys = reqs[k].getExtDataKeys(); + Enumeration<String> reqKeys = reqs[k].getExtDataKeys(); while (reqKeys.hasMoreElements()) { - String reqKey = (String) reqKeys.nextElement(); + String reqKey = reqKeys.nextElement(); String reqVal = reqs[k].getExtDataInString(reqKey); if (reqVal != null) { CMS.debug("ProfileSubmitServlet: key=$request." + reqKey + "$ value=" + reqVal); @@ -1491,15 +1492,15 @@ public class ProfileSubmitServlet extends ProfileServlet { } else { CMS.debug("ProfileSubmitServlet xmlOutput: no certInfo found in request"); } - Enumeration outputIds = profile.getProfileOutputIds(); + Enumeration<String> outputIds = profile.getProfileOutputIds(); if (outputIds != null) { while (outputIds.hasMoreElements()) { - String outputId = (String) outputIds.nextElement(); + String outputId = outputIds.nextElement(); IProfileOutput profileOutput = profile.getProfileOutput(outputId); - Enumeration outputNames = profileOutput.getValueNames(); + Enumeration<String> outputNames = profileOutput.getValueNames(); if (outputNames != null) { while (outputNames.hasMoreElements()) { - String outputName = (String) outputNames.nextElement(); + String outputName = outputNames.nextElement(); if (!outputName.equals("b64_cert") && !outputName.equals("pkcs7")) continue; try { diff --git a/pki/base/common/src/com/netscape/cms/servlet/request/CertReqParser.java b/pki/base/common/src/com/netscape/cms/servlet/request/CertReqParser.java index 7fc353a0f..d8fc68a69 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/request/CertReqParser.java +++ b/pki/base/common/src/com/netscape/cms/servlet/request/CertReqParser.java @@ -127,7 +127,7 @@ public class CertReqParser extends ReqParser { arg.addStringValue("certExtsEnabled", "yes"); int saCounter = 0; - Enumeration enum1 = req.getExtDataKeys(); + Enumeration<String> enum1 = req.getExtDataKeys(); // gross hack String prefix = "record."; @@ -136,14 +136,14 @@ public class CertReqParser extends ReqParser { prefix = "header."; while (enum1.hasMoreElements()) { - String name = (String) enum1.nextElement(); + String name = enum1.nextElement(); if (mDetails) { // show all http parameters stored in request. if (name.equalsIgnoreCase(IRequest.HTTP_PARAMS)) { - Hashtable http_params = req.getExtDataInHashtable(name); + Hashtable<String, String> http_params = req.getExtDataInHashtable(name); // show certType specially - String certType = (String) http_params.get(IRequest.CERT_TYPE); + String certType = http_params.get(IRequest.CERT_TYPE); if (certType != null) { arg.addStringValue(IRequest.CERT_TYPE, certType); @@ -155,13 +155,13 @@ public class CertReqParser extends ReqParser { } // show all http parameters in request int counter = 0; - Enumeration elms = http_params.keys(); + Enumeration<String> elms = http_params.keys(); while (elms.hasMoreElements()) { String parami = IRequest.HTTP_PARAMS + LB + String.valueOf(counter++) + RB; // hack - String n = (String) elms.nextElement(); + String n = elms.nextElement(); String rawJS = "new Object;\n\r" + prefix + parami + ".name=\"" + CMSTemplate.escapeJavaScriptString(n) + "\";\n\r" + @@ -173,15 +173,15 @@ public class CertReqParser extends ReqParser { } } // show all http headers stored in request. else if (name.equalsIgnoreCase(IRequest.HTTP_HEADERS)) { - Hashtable http_hdrs = req.getExtDataInHashtable(name); - Enumeration elms = http_hdrs.keys(); + Hashtable<String, String> http_hdrs = req.getExtDataInHashtable(name); + Enumeration<String> elms = http_hdrs.keys(); int counter = 0; while (elms.hasMoreElements()) { String parami = IRequest.HTTP_HEADERS + LB + String.valueOf(counter++) + RB; // hack - String n = (String) elms.nextElement(); + String n = elms.nextElement(); String rawJS = "new Object;\n\r" + prefix + parami + ".name=\"" + CMSTemplate.escapeJavaScriptString(n) + "\";\n\r" + @@ -194,14 +194,14 @@ public class CertReqParser extends ReqParser { } // show all auth token stored in request. else if (name.equalsIgnoreCase(IRequest.AUTH_TOKEN)) { IAuthToken auth_token = req.getExtDataInAuthToken(name); - Enumeration elms = auth_token.getElements(); + Enumeration<String> elms = auth_token.getElements(); int counter = 0; while (elms.hasMoreElements()) { String parami = IRequest.AUTH_TOKEN + LB + String.valueOf(counter++) + RB; // hack - String n = (String) elms.nextElement(); + String n = elms.nextElement(); Object authTokenValue = auth_token.getInStringArray(n); if (authTokenValue == null) { authTokenValue = auth_token.getInString(n); @@ -274,7 +274,7 @@ public class CertReqParser extends ReqParser { } if (name.equalsIgnoreCase(IRequest.ERRORS)) { - Vector errorStrings = req.getExtDataInStringVector(name); + Vector<String> errorStrings = req.getExtDataInStringVector(name); if (errorStrings != null) { StringBuffer errInfo = new StringBuffer(); @@ -346,10 +346,10 @@ public class CertReqParser extends ReqParser { } catch (Exception e) { } if (extensions != null) { - Enumeration exts = extensions.getElements(); + Enumeration<Extension> exts = extensions.getAttributes(); while (exts.hasMoreElements()) { - Extension ext = (Extension) exts.nextElement(); + Extension ext = exts.nextElement(); // only know about ns cert type if (ext instanceof NSCertTypeExtension) { @@ -526,16 +526,16 @@ public class CertReqParser extends ReqParser { } } if (name.equalsIgnoreCase(IRequest.FINGERPRINTS) && mDetails) { - Hashtable fingerprints = + Hashtable<String, String> fingerprints = req.getExtDataInHashtable(IRequest.FINGERPRINTS); if (fingerprints != null) { String namesAndHashes = null; - Enumeration enumFingerprints = fingerprints.keys(); + Enumeration<String> enumFingerprints = fingerprints.keys(); while (enumFingerprints.hasMoreElements()) { - String hashname = (String) enumFingerprints.nextElement(); - String hashvalue = (String) fingerprints.get(hashname); + String hashname = enumFingerprints.nextElement(); + String hashvalue = fingerprints.get(hashname); byte[] fingerprint = CMS.AtoB(hashvalue); String ppFingerprint = pp.toHexString(fingerprint, 0); @@ -568,7 +568,8 @@ public class CertReqParser extends ReqParser { int j = 0; StringBuffer sb = new StringBuffer(); - for (Enumeration n = ((Vector) v).elements(); n.hasMoreElements(); j++) { + for (@SuppressWarnings("unchecked") + Enumeration<String> n = ((Vector<String>) v).elements(); n.hasMoreElements(); j++) { sb.append(";\n"); sb.append(valuename); sb.append(LB); @@ -678,7 +679,7 @@ public class CertReqParser extends ReqParser { } int saCounter = 0; - Enumeration enum1 = req.getExtDataKeys(); + Enumeration<String> enum1 = req.getExtDataKeys(); // gross hack String prefix = "record."; @@ -692,16 +693,16 @@ public class CertReqParser extends ReqParser { if (mDetails) { // show all http parameters stored in request. if (name.equalsIgnoreCase(IRequest.HTTP_PARAMS)) { - Hashtable http_params = req.getExtDataInHashtable(name); + Hashtable<String, String> http_params = req.getExtDataInHashtable(name); // show certType specially - String certType = (String) http_params.get(IRequest.CERT_TYPE); + String certType = http_params.get(IRequest.CERT_TYPE); if (certType != null) { arg.addStringValue(IRequest.CERT_TYPE, certType); } // show all http parameters in request int counter = 0; - Enumeration elms = http_params.keys(); + Enumeration<String> elms = http_params.keys(); while (elms.hasMoreElements()) { String parami = @@ -719,15 +720,15 @@ public class CertReqParser extends ReqParser { } } // show all http headers stored in request. else if (name.equalsIgnoreCase(IRequest.HTTP_HEADERS)) { - Hashtable http_hdrs = req.getExtDataInHashtable(name); - Enumeration elms = http_hdrs.keys(); + Hashtable<String, String> http_hdrs = req.getExtDataInHashtable(name); + Enumeration<String> elms = http_hdrs.keys(); int counter = 0; while (elms.hasMoreElements()) { String parami = IRequest.HTTP_HEADERS + LB + String.valueOf(counter++) + RB; // hack - String n = (String) elms.nextElement(); + String n = elms.nextElement(); String rawJS = "new Object;\n\r" + prefix + parami + ".name=\"" + CMSTemplate.escapeJavaScriptString(n) + "\";\n\r" + @@ -740,7 +741,7 @@ public class CertReqParser extends ReqParser { } // show all auth token stored in request. else if (name.equalsIgnoreCase(IRequest.AUTH_TOKEN)) { IAuthToken auth_token = req.getExtDataInAuthToken(name); - Enumeration elms = auth_token.getElements(); + Enumeration<String> elms = auth_token.getElements(); int counter = 0; while (elms.hasMoreElements()) { @@ -801,7 +802,7 @@ public class CertReqParser extends ReqParser { } if (name.equalsIgnoreCase(IRequest.ERRORS)) { - Vector errorsVector = req.getExtDataInStringVector(name); + Vector<String> errorsVector = req.getExtDataInStringVector(name); if (errorsVector != null) { StringBuffer errInfo = new StringBuffer(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/request/CheckRequest.java b/pki/base/common/src/com/netscape/cms/servlet/request/CheckRequest.java index b0a70ffc1..1d04952d1 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/request/CheckRequest.java +++ b/pki/base/common/src/com/netscape/cms/servlet/request/CheckRequest.java @@ -502,7 +502,8 @@ public class CheckRequest extends CMSServlet { ByteArrayInputStream issuer1 = new ByteArrayInputStream(((X500Name) cert.getIssuerDN()).getEncoded()); Name issuer = (Name) Name.getTemplate().decode(issuer1); - IssuerAndSerialNumber ias = new + IssuerAndSerialNumber ias = + new IssuerAndSerialNumber(issuer, new INTEGER(cert.getSerialNumber() .toString())); SignerIdentifier si = new @@ -511,8 +512,8 @@ public class CheckRequest extends CMSServlet { // SHA1 is the default digest Alg for now. DigestAlgorithm digestAlg = null; SignatureAlgorithm signAlg = null; - org.mozilla.jss.crypto.PrivateKey privKey = CryptoManager.getInstance() - .findPrivKeyByCert(x509cert); + org.mozilla.jss.crypto.PrivateKey privKey = + CryptoManager.getInstance().findPrivKeyByCert(x509cert); org.mozilla.jss.crypto.PrivateKey.Type keyType = privKey.getType(); if (keyType.equals(org.mozilla.jss.crypto.PrivateKey.RSA)) @@ -557,7 +558,8 @@ public class CheckRequest extends CMSServlet { for (int j = 0; j < certsInChain.length; j++) { ByteArrayInputStream is = new ByteArrayInputStream(certsInChain[j].getEncoded()); - org.mozilla.jss.pkix.cert.Certificate certJss = (org.mozilla.jss.pkix.cert.Certificate) + org.mozilla.jss.pkix.cert.Certificate certJss = + (org.mozilla.jss.pkix.cert.Certificate) org.mozilla.jss.pkix.cert.Certificate.getTemplate().decode(is); jsscerts.addElement(certJss); @@ -566,7 +568,8 @@ public class CheckRequest extends CMSServlet { SignedData fResponse = new SignedData(digestAlgs, ci, jsscerts, null, signInfos); - org.mozilla.jss.pkix.cms.ContentInfo fullResponse = new + org.mozilla.jss.pkix.cms.ContentInfo fullResponse = + new org.mozilla.jss.pkix.cms.ContentInfo( org.mozilla.jss.pkix.cms.ContentInfo.SIGNED_DATA, fResponse); ByteArrayOutputStream ostream = new diff --git a/pki/base/common/src/com/netscape/cms/servlet/request/ProcessCertReq.java b/pki/base/common/src/com/netscape/cms/servlet/request/ProcessCertReq.java index cbed8ae6b..cbe73c79f 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/request/ProcessCertReq.java +++ b/pki/base/common/src/com/netscape/cms/servlet/request/ProcessCertReq.java @@ -615,7 +615,7 @@ public class ProcessCertReq extends CMSServlet { String addExts = req.getParameter("addExts"); if (addExts != null && !addExts.trim().equals("")) { - Vector extsToBeAdded = new Vector(); + Vector<Extension> extsToBeAdded = new Vector<Extension>(); byte[] b = (byte[]) (com.netscape.osutil.OSUtil.AtoB(addExts)); @@ -683,7 +683,8 @@ public class ProcessCertReq extends CMSServlet { new BasicConstraintsExtension(isCA.booleanValue(), pathLen); extensions.delete(BasicConstraintsExtension.NAME); - extensions.set(BasicConstraintsExtension.NAME, (Extension) bcExt0); + extensions.set(BasicConstraintsExtension.NAME, + (Extension) bcExt0); alterationCounter++; } } @@ -753,22 +754,24 @@ public class ProcessCertReq extends CMSServlet { } catch (Exception e1) { } // create extension - PresenceServerExtension pseExt = new PresenceServerExtension(Critical, Version, - StreetAddress, TelephoneNumber, RFC822Name, IMID, HostName, PortNumber, - MaxUsers, ServiceLevel); + PresenceServerExtension pseExt = + new PresenceServerExtension(Critical, Version, StreetAddress, + TelephoneNumber, RFC822Name, IMID, HostName, PortNumber, MaxUsers, + ServiceLevel); extensions.set(pseExt.getExtensionId().toString(), pseExt); } if (mExtraAgentParams) { - Enumeration extraparams = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> extraparams = req.getParameterNames(); int l = IRequest.AGENT_PARAMS.length() + 1; int ap_counter = 0; - Hashtable agentparamsargblock = new Hashtable(); + Hashtable<String, String> agentparamsargblock = new Hashtable<String, String>(); if (extraparams != null) { while (extraparams.hasMoreElements()) { - String s = (String) extraparams.nextElement(); + String s = extraparams.nextElement(); if (s.startsWith(IRequest.AGENT_PARAMS)) { String param_value = req.getParameter(s); @@ -933,7 +936,8 @@ public class ProcessCertReq extends CMSServlet { authMgr, "completed", issuedCerts[i].getSubjectDN(), - "cert issued serial number: 0x" + + "cert issued serial number: 0x" + + issuedCerts[i].getSerialNumber().toString(16) + " time: " + (endTime - startTime) } ); diff --git a/pki/base/common/src/com/netscape/cms/servlet/tks/TokenServlet.java b/pki/base/common/src/com/netscape/cms/servlet/tks/TokenServlet.java index 715a2baf8..fc45395e9 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/tks/TokenServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/tks/TokenServlet.java @@ -396,10 +396,11 @@ public class TokenServlet extends CMSServlet { try { - byte macKeyArray[] = com.netscape.cmsutil.util.Utils.SpecialDecode(sconfig.getString("tks." - + keySet + ".mac_key")); - CMS.debug("TokenServlet about to try ComputeSessionKey selectedToken=" + selectedToken - + " keyNickName=" + keyNickName); + byte macKeyArray[] = + com.netscape.cmsutil.util.Utils.SpecialDecode(sconfig.getString("tks." + + keySet + ".mac_key")); + CMS.debug("TokenServlet about to try ComputeSessionKey selectedToken=" + + selectedToken + " keyNickName=" + keyNickName); session_key = SessionKey.ComputeSessionKey( selectedToken, keyNickName, card_challenge, host_challenge, keyInfo, CUID, macKeyArray, useSoftToken_s, keySet, transportKeyName); @@ -410,8 +411,9 @@ public class TokenServlet extends CMSServlet { } - byte encKeyArray[] = com.netscape.cmsutil.util.Utils.SpecialDecode(sconfig.getString("tks." - + keySet + ".auth_key")); + byte encKeyArray[] = + com.netscape.cmsutil.util.Utils.SpecialDecode(sconfig.getString("tks." + + keySet + ".auth_key")); enc_session_key = SessionKey.ComputeEncSessionKey( selectedToken, keyNickName, card_challenge, host_challenge, keyInfo, CUID, encKeyArray, useSoftToken_s, keySet); @@ -433,8 +435,9 @@ public class TokenServlet extends CMSServlet { **/ CMS.debug("TokenServlet: calling ComputeKekKey"); - byte kekKeyArray[] = com.netscape.cmsutil.util.Utils.SpecialDecode(sconfig.getString("tks." - + keySet + ".kek_key")); + byte kekKeyArray[] = + com.netscape.cmsutil.util.Utils.SpecialDecode(sconfig.getString("tks." + + keySet + ".kek_key")); kek_key = SessionKey.ComputeKekKey( selectedToken, keyNickName, card_challenge, @@ -545,8 +548,9 @@ public class TokenServlet extends CMSServlet { } // if (serversideKeygen == true) - byte authKeyArray[] = com.netscape.cmsutil.util.Utils.SpecialDecode(sconfig.getString("tks." - + keySet + ".auth_key")); + byte authKeyArray[] = + com.netscape.cmsutil.util.Utils.SpecialDecode(sconfig.getString("tks." + + keySet + ".auth_key")); host_cryptogram = SessionKey.ComputeCryptogram( selectedToken, keyNickName, card_challenge, host_challenge, keyInfo, CUID, 0, authKeyArray, useSoftToken_s, keySet); @@ -869,8 +873,8 @@ public class TokenServlet extends CMSServlet { " oldKeyNickName=" + oldKeyNickName + " newKeyNickName=" + newKeyNickName); - byte kekKeyArray[] = com.netscape.cmsutil.util.Utils.SpecialDecode(sconfig.getString("tks." + keySet - + ".kek_key")); + byte kekKeyArray[] = + com.netscape.cmsutil.util.Utils.SpecialDecode(sconfig.getString("tks." + keySet + ".kek_key")); KeySetData = SessionKey.DiversifyKey(oldSelectedToken, newSelectedToken, oldKeyNickName, newKeyNickName, rnewKeyInfo, CUID, kekKeyArray, useSoftToken_s, keySet); @@ -1074,8 +1078,8 @@ public class TokenServlet extends CMSServlet { keyNickName = st.nextToken(); } - byte kekKeyArray[] = com.netscape.cmsutil.util.Utils.SpecialDecode(sconfig.getString("tks." + keySet - + ".kek_key")); + byte kekKeyArray[] = + com.netscape.cmsutil.util.Utils.SpecialDecode(sconfig.getString("tks." + keySet + ".kek_key")); encryptedData = SessionKey.EncryptData( selectedToken, keyNickName, data, keyInfo, CUID, kekKeyArray, useSoftToken_s, keySet); |