diff options
author | Endi Sukma Dewata <edewata@redhat.com> | 2012-02-13 15:11:56 -0600 |
---|---|---|
committer | Endi Sukma Dewata <edewata@redhat.com> | 2012-02-20 14:56:55 -0600 |
commit | 26f168f38aa13ed6f5d1be09ab8fbe828f631757 (patch) | |
tree | bb3ce31a7d65ac17d0132488f1c34714df8e2dda /pki/base | |
parent | 046cd4e89b9a0deb3ce1bb26833bd86567fe0b4b (diff) | |
download | pki-26f168f38aa13ed6f5d1be09ab8fbe828f631757.tar.gz pki-26f168f38aa13ed6f5d1be09ab8fbe828f631757.tar.xz pki-26f168f38aa13ed6f5d1be09ab8fbe828f631757.zip |
Removed unused variables (part 1).
This patch brings down the warnings from 2917 to 2406.
Ticket #103
Diffstat (limited to 'pki/base')
150 files changed, 217 insertions, 982 deletions
diff --git a/pki/base/common/src/LogMessages.properties b/pki/base/common/src/LogMessages.properties index fada5eb88..bd108bf80 100644 --- a/pki/base/common/src/LogMessages.properties +++ b/pki/base/common/src/LogMessages.properties @@ -488,7 +488,7 @@ CMSCORE_USRGRP_INTERNAL_DB=find User: Could not get connection to internaldb. Er CMSCORE_USRGRP_FIND_USER_BY_CERT=Find User By Certificate Error {0} CMSCORE_USRGRP_FIND_USERS=Find Users Error {0} CMSCORE_USRGRP_LIST_USERS=List Users Error {0} -CMSCORE_USRGRP_BUILD_USER=DN not found +CMSCORE_USRGRP_BUILD_USER=DN not found {0} CMSCORE_USRGRP_ADD_USER=add User: Could not get connection to internaldb. Error {0} CMSCORE_USRGRP_ADD_USER_CERT=add User Certificate {0} CMSCORE_USRGRP_REMOVE_USER=remove User {0} diff --git a/pki/base/common/src/com/netscape/certsrv/apps/CMS.java b/pki/base/common/src/com/netscape/certsrv/apps/CMS.java index 75a7e2059..5b8aa2c78 100644 --- a/pki/base/common/src/com/netscape/certsrv/apps/CMS.java +++ b/pki/base/common/src/com/netscape/certsrv/apps/CMS.java @@ -1564,13 +1564,11 @@ public final class CMS { String classname = "com.netscape.cmscore.apps.CMSEngine"; - CMS cms = null; - try { ICMSEngine engine = (ICMSEngine) Class.forName(classname).newInstance(); - cms = new CMS(engine); + CMS.setCMSEngine(engine); IConfigStore mainConfig = createFileConfigStore(path); CMS.init(null, mainConfig); CMS.startup(); diff --git a/pki/base/common/src/com/netscape/certsrv/kra/ProofOfArchival.java b/pki/base/common/src/com/netscape/certsrv/kra/ProofOfArchival.java index 9d17cbbb2..df05c882f 100644 --- a/pki/base/common/src/com/netscape/certsrv/kra/ProofOfArchival.java +++ b/pki/base/common/src/com/netscape/certsrv/kra/ProofOfArchival.java @@ -282,19 +282,13 @@ public class ProofOfArchival implements IDBObj, IProofOfArchival, Serializable { } // serial number - DerOutputStream serialno = new DerOutputStream(); - seq.putInteger(new BigInt(mSerialNo)); // subject name - DerOutputStream subject = new DerOutputStream(); - - (new X500Name(mSubject)).encode(seq); + new X500Name(mSubject).encode(seq); // issuer name - DerOutputStream issuer = new DerOutputStream(); - - (new X500Name(mIssuer)).encode(seq); + new X500Name(mIssuer).encode(seq); // issue date seq.putUTCTime(mDateOfArchival); @@ -383,8 +377,11 @@ public class ProofOfArchival implements IDBObj, IProofOfArchival, Serializable { "no signature found")); } - AlgorithmId algid = AlgorithmId.parse(seq[1]); - byte signature[] = seq[2].getBitString(); + @SuppressWarnings("unused") + AlgorithmId algid = AlgorithmId.parse(seq[1]); // consume algid + + @SuppressWarnings("unused") + byte signature[] = seq[2].getBitString(); // consume signature decodePOA(val, null); } else { diff --git a/pki/base/common/src/com/netscape/cms/authentication/PortalEnroll.java b/pki/base/common/src/com/netscape/cms/authentication/PortalEnroll.java index 8049ffb11..fe2c352ec 100644 --- a/pki/base/common/src/com/netscape/cms/authentication/PortalEnroll.java +++ b/pki/base/common/src/com/netscape/cms/authentication/PortalEnroll.java @@ -200,7 +200,7 @@ public class PortalEnroll extends DirBasedAuthentication { LDAPv2.SCOPE_SUB, "(uid=" + uid + ")", null, false); if (res.hasMoreElements()) { - LDAPEntry entry = (LDAPEntry) res.nextElement(); + res.nextElement(); // consume the entry throw new EAuthUserError(CMS.getUserMessage("CMS_AUTHENTICATION_INVALID_ATTRIBUTE_VALUE", "UID already exists.")); diff --git a/pki/base/common/src/com/netscape/cms/authorization/AAclAuthz.java b/pki/base/common/src/com/netscape/cms/authorization/AAclAuthz.java index dcce8277e..73995e6cd 100644 --- a/pki/base/common/src/com/netscape/cms/authorization/AAclAuthz.java +++ b/pki/base/common/src/com/netscape/cms/authorization/AAclAuthz.java @@ -127,9 +127,6 @@ public abstract class AAclAuthz { evaluator = (IAccessEvaluator) Class.forName(evalClassPath).newInstance(); } catch (Exception e) { - String errMsg = "init(): failed to load class: " + - evalClassPath + ":" + e.toString(); - throw new EACLsException(CMS.getUserMessage("CMS_ACL_CLASS_LOAD_FAIL", evalClassPath)); } @@ -139,8 +136,6 @@ public abstract class AAclAuthz { // store evaluator registerEvaluator(type, evaluator); } else { - String errMsg = "access evaluator " + type + " is null"; - log(ILogger.LL_FAILURE, CMS.getLogMessage("AUTHZ_EVALUATOR_NULL", type)); } } @@ -278,9 +273,6 @@ public abstract class AAclAuthz { params[0] = name; params[1] = perm; - String errMsg = "checkPermission(): permission denied for the resource " + - name + " on operation " + perm; - log(ILogger.LL_SECURITY, CMS.getLogMessage("AUTHZ_EVALUATOR_ACCESS_DENIED", name, perm)); throw new EACLsException(CMS.getUserMessage("CMS_ACL_NO_PERMISSION", @@ -441,8 +433,6 @@ public abstract class AAclAuthz { IAccessEvaluator evaluator = (IAccessEvaluator) mEvaluators.get(type); if (evaluator == null) { - String errMsg = "evaluator for type " + type + "not found"; - log(ILogger.LL_FAILURE, CMS.getLogMessage("AUTHZ_EVALUATOR_NOT_FOUND", type)); return false; } @@ -536,9 +526,6 @@ public abstract class AAclAuthz { params[0] = name; params[1] = perm; - String errMsg = "checkPermission(): permission denied for the resource " + - name + " on operation " + perm; - log(ILogger.LL_SECURITY, CMS.getLogMessage("AUTHZ_EVALUATOR_ACCESS_DENIED", name, perm)); @@ -707,8 +694,6 @@ public abstract class AAclAuthz { IAccessEvaluator evaluator = (IAccessEvaluator) mEvaluators.get(type); if (evaluator == null) { - String errMsg = "evaluator for type " + type + "not found"; - log(ILogger.LL_FAILURE, CMS.getLogMessage("AUTHZ_EVALUATOR_NOT_FOUND", type)); return false; } @@ -765,8 +750,6 @@ public abstract class AAclAuthz { */ public void updateACLs(String id, String rights, String strACLs, String desc) throws EACLsException { - ACL acl = (ACL) getACL(id); - String resourceACLs = id; if (rights != null) diff --git a/pki/base/common/src/com/netscape/cms/authorization/BasicAclAuthz.java b/pki/base/common/src/com/netscape/cms/authorization/BasicAclAuthz.java index c3e65ca82..f6b1b6713 100644 --- a/pki/base/common/src/com/netscape/cms/authorization/BasicAclAuthz.java +++ b/pki/base/common/src/com/netscape/cms/authorization/BasicAclAuthz.java @@ -179,9 +179,6 @@ public class BasicAclAuthz extends AAclAuthz // flushing failed, set flag needsFlush = true; - String errMsg = "updateACLs: failed to flushResourceACLs(): " - + ex.toString(); - log(ILogger.LL_FAILURE, CMS.getLogMessage("AUTHZ_EVALUATOR_FLUSH_RESOURCES", ex.toString())); throw new EACLsException(CMS.getUserMessage("CMS_ACL_UPDATE_FAIL")); diff --git a/pki/base/common/src/com/netscape/cms/authorization/DirAclAuthz.java b/pki/base/common/src/com/netscape/cms/authorization/DirAclAuthz.java index df24f275e..acc3ffbb7 100644 --- a/pki/base/common/src/com/netscape/cms/authorization/DirAclAuthz.java +++ b/pki/base/common/src/com/netscape/cms/authorization/DirAclAuthz.java @@ -136,7 +136,8 @@ public class DirAclAuthz extends AAclAuthz mBaseDN = ldapConfig.getString(PROP_BASEDN, null); try { - String name1 = ldapConfig.getString("ldapconn.host"); + @SuppressWarnings("unused") + String hostname = ldapConfig.getString("ldapconn.host"); // check for errors } catch (EBaseException e) { if (CMS.isPreOpMode()) return; @@ -172,8 +173,6 @@ public class DirAclAuthz extends AAclAuthz log(ILogger.LL_INFO, "ldap search found no cn=aclResources"); } } catch (LDAPException e) { - String errMsg = "init() -" + e.toString(); - log(ILogger.LL_FAILURE, CMS.getLogMessage("AUTHZ_EVALUATOR_INIT_ERROR", e.toString())); throw new EACLsException(CMS.getUserMessage("CMS_ACL_CONNECT_LDAP_FAIL", mBaseDN)); } catch (EBaseException e) { @@ -274,9 +273,6 @@ public class DirAclAuthz extends AAclAuthz // flushing failed, set flag needsFlush = true; - String errMsg = "updateACLs: failed to flushResourceACLs(): " - + ex.toString(); - log(ILogger.LL_FAILURE, CMS.getLogMessage("AUTHZ_EVALUATOR_FLUSH_RESOURCES", ex.toString())); throw new EACLsException(CMS.getUserMessage("CMS_ACL_UPDATE_FAIL")); diff --git a/pki/base/common/src/com/netscape/cms/crl/CMSAuthInfoAccessExtension.java b/pki/base/common/src/com/netscape/cms/crl/CMSAuthInfoAccessExtension.java index f3aa5180b..d070cc6fd 100644 --- a/pki/base/common/src/com/netscape/cms/crl/CMSAuthInfoAccessExtension.java +++ b/pki/base/common/src/com/netscape/cms/crl/CMSAuthInfoAccessExtension.java @@ -33,7 +33,6 @@ import com.netscape.certsrv.base.EPropertyNotFound; import com.netscape.certsrv.base.IConfigStore; import com.netscape.certsrv.base.IExtendedPluginInfo; import com.netscape.certsrv.ca.ICMSCRLExtension; -import com.netscape.certsrv.ca.ICRLIssuingPoint; import com.netscape.certsrv.common.NameValuePairs; import com.netscape.certsrv.logging.ILogger; @@ -70,7 +69,6 @@ public class CMSAuthInfoAccessExtension public Extension getCRLExtension(IConfigStore config, Object ip, boolean critical) { - ICRLIssuingPoint crlIssuingPoint = (ICRLIssuingPoint) ip; AuthInfoAccessExtension authInfoAccessExt = new AuthInfoAccessExtension(critical); int numberOfAccessDescriptions = 0; diff --git a/pki/base/common/src/com/netscape/cms/crl/CMSCertificateIssuerExtension.java b/pki/base/common/src/com/netscape/cms/crl/CMSCertificateIssuerExtension.java index 02556d495..67f4736c7 100644 --- a/pki/base/common/src/com/netscape/cms/crl/CMSCertificateIssuerExtension.java +++ b/pki/base/common/src/com/netscape/cms/crl/CMSCertificateIssuerExtension.java @@ -33,7 +33,6 @@ import com.netscape.certsrv.base.EPropertyNotFound; import com.netscape.certsrv.base.IConfigStore; import com.netscape.certsrv.base.IExtendedPluginInfo; import com.netscape.certsrv.ca.ICMSCRLExtension; -import com.netscape.certsrv.ca.ICRLIssuingPoint; import com.netscape.certsrv.common.NameValuePairs; import com.netscape.certsrv.logging.ILogger; @@ -71,8 +70,6 @@ public class CMSCertificateIssuerExtension CertificateIssuerExtension certIssuerExt = null; int numNames = 0; - ICRLIssuingPoint crlIssuingPoint = (ICRLIssuingPoint) ip; - try { numNames = config.getInteger("numNames", 0); } catch (EBaseException e) { diff --git a/pki/base/common/src/com/netscape/cms/crl/CMSFreshestCRLExtension.java b/pki/base/common/src/com/netscape/cms/crl/CMSFreshestCRLExtension.java index 38eb7a1c6..edb6494af 100644 --- a/pki/base/common/src/com/netscape/cms/crl/CMSFreshestCRLExtension.java +++ b/pki/base/common/src/com/netscape/cms/crl/CMSFreshestCRLExtension.java @@ -35,7 +35,6 @@ import com.netscape.certsrv.base.EPropertyNotFound; import com.netscape.certsrv.base.IConfigStore; import com.netscape.certsrv.base.IExtendedPluginInfo; import com.netscape.certsrv.ca.ICMSCRLExtension; -import com.netscape.certsrv.ca.ICRLIssuingPoint; import com.netscape.certsrv.common.NameValuePairs; import com.netscape.certsrv.logging.ILogger; @@ -68,7 +67,6 @@ public class CMSFreshestCRLExtension public Extension getCRLExtension(IConfigStore config, Object ip, boolean critical) { - ICRLIssuingPoint crlIssuingPoint = (ICRLIssuingPoint) ip; FreshestCRLExtension freshestCRLExt = null; int numPoints = 0; diff --git a/pki/base/common/src/com/netscape/cms/crl/CMSHoldInstructionExtension.java b/pki/base/common/src/com/netscape/cms/crl/CMSHoldInstructionExtension.java index ca7642865..df8d058ce 100644 --- a/pki/base/common/src/com/netscape/cms/crl/CMSHoldInstructionExtension.java +++ b/pki/base/common/src/com/netscape/cms/crl/CMSHoldInstructionExtension.java @@ -31,7 +31,6 @@ import com.netscape.certsrv.base.EPropertyNotFound; import com.netscape.certsrv.base.IConfigStore; import com.netscape.certsrv.base.IExtendedPluginInfo; import com.netscape.certsrv.ca.ICMSCRLExtension; -import com.netscape.certsrv.ca.ICRLIssuingPoint; import com.netscape.certsrv.common.NameValuePairs; import com.netscape.certsrv.logging.ILogger; @@ -74,8 +73,6 @@ public class CMSHoldInstructionExtension HoldInstructionExtension holdInstrExt = null; String instruction = null; - ICRLIssuingPoint crlIssuingPoint = (ICRLIssuingPoint) ip; - try { instruction = config.getString(PROP_INSTR); } catch (EPropertyNotFound e) { diff --git a/pki/base/common/src/com/netscape/cms/crl/CMSIssuerAlternativeNameExtension.java b/pki/base/common/src/com/netscape/cms/crl/CMSIssuerAlternativeNameExtension.java index 183de1b43..88e859798 100644 --- a/pki/base/common/src/com/netscape/cms/crl/CMSIssuerAlternativeNameExtension.java +++ b/pki/base/common/src/com/netscape/cms/crl/CMSIssuerAlternativeNameExtension.java @@ -42,7 +42,6 @@ import com.netscape.certsrv.base.EPropertyNotFound; import com.netscape.certsrv.base.IConfigStore; import com.netscape.certsrv.base.IExtendedPluginInfo; import com.netscape.certsrv.ca.ICMSCRLExtension; -import com.netscape.certsrv.ca.ICRLIssuingPoint; import com.netscape.certsrv.common.NameValuePairs; import com.netscape.certsrv.logging.ILogger; @@ -85,7 +84,6 @@ public class CMSIssuerAlternativeNameExtension public Extension getCRLExtension(IConfigStore config, Object ip, boolean critical) { - ICRLIssuingPoint crlIssuingPoint = (ICRLIssuingPoint) ip; IssuerAlternativeNameExtension issuerAltNameExt = null; int numNames = 0; diff --git a/pki/base/common/src/com/netscape/cms/crl/CMSIssuingDistributionPointExtension.java b/pki/base/common/src/com/netscape/cms/crl/CMSIssuingDistributionPointExtension.java index 3df243305..21bd86b0a 100644 --- a/pki/base/common/src/com/netscape/cms/crl/CMSIssuingDistributionPointExtension.java +++ b/pki/base/common/src/com/netscape/cms/crl/CMSIssuingDistributionPointExtension.java @@ -38,7 +38,6 @@ import com.netscape.certsrv.base.EPropertyNotFound; import com.netscape.certsrv.base.IConfigStore; import com.netscape.certsrv.base.IExtendedPluginInfo; import com.netscape.certsrv.ca.ICMSCRLExtension; -import com.netscape.certsrv.ca.ICRLIssuingPoint; import com.netscape.certsrv.common.NameValuePairs; import com.netscape.certsrv.logging.ILogger; @@ -88,7 +87,6 @@ public class CMSIssuingDistributionPointExtension boolean critical) { CMS.debug("in CMSIssuingDistributionPointExtension::getCRLExtension."); - ICRLIssuingPoint crlIssuingPoint = (ICRLIssuingPoint) ip; IssuingDistributionPointExtension issuingDPointExt = null; IssuingDistributionPoint issuingDPoint = new IssuingDistributionPoint(); diff --git a/pki/base/common/src/com/netscape/cms/jobs/PublishCertsJob.java b/pki/base/common/src/com/netscape/cms/jobs/PublishCertsJob.java index efca74168..903f83691 100644 --- a/pki/base/common/src/com/netscape/cms/jobs/PublishCertsJob.java +++ b/pki/base/common/src/com/netscape/cms/jobs/PublishCertsJob.java @@ -176,7 +176,6 @@ public class PublishCertsJob extends AJobBase getId() + " : run()"); // get time now..."now" is before the loop Date date = CMS.getCurrentDate(); - long now = date.getTime(); DateFormat dateFormat = DateFormat.getDateTimeInstance(); String nowString = dateFormat.format(date); diff --git a/pki/base/common/src/com/netscape/cms/jobs/RenewalNotificationJob.java b/pki/base/common/src/com/netscape/cms/jobs/RenewalNotificationJob.java index 8abe027c4..621d987fe 100644 --- a/pki/base/common/src/com/netscape/cms/jobs/RenewalNotificationJob.java +++ b/pki/base/common/src/com/netscape/cms/jobs/RenewalNotificationJob.java @@ -584,8 +584,6 @@ public class RenewalNotificationJob if (mHTML == true) mn.setContentType("text/html"); - String failedString = null; - mn.setContent(msg); mn.sendNotification(); diff --git a/pki/base/common/src/com/netscape/cms/jobs/RequestInQueueJob.java b/pki/base/common/src/com/netscape/cms/jobs/RequestInQueueJob.java index 0a3bf0e13..adddc9755 100644 --- a/pki/base/common/src/com/netscape/cms/jobs/RequestInQueueJob.java +++ b/pki/base/common/src/com/netscape/cms/jobs/RequestInQueueJob.java @@ -163,7 +163,6 @@ public class RequestInQueueJob extends AJobBase return; Date date = CMS.getCurrentDate(); - long now = date.getTime(); DateFormat dateFormat = DateFormat.getDateTimeInstance(); String nowString = dateFormat.format(date); diff --git a/pki/base/common/src/com/netscape/cms/password/PasswordChecker.java b/pki/base/common/src/com/netscape/cms/password/PasswordChecker.java index d0b596c5f..847f3a2c1 100644 --- a/pki/base/common/src/com/netscape/cms/password/PasswordChecker.java +++ b/pki/base/common/src/com/netscape/cms/password/PasswordChecker.java @@ -42,14 +42,8 @@ public class PasswordChecker implements IPasswordCheck, IConfigPasswordCheck { public boolean isGoodConfigPassword(String mPassword) { if (mPassword == null || mPassword.length() == 0) { - EPasswordCheckException e = new EPasswordCheckException( - "Empty Password"); - return false; } else if (mPassword.length() < MIN_LEN) { - EPasswordCheckException e = new EPasswordCheckException( - "Minimium Length is " + MIN_LEN); - return false; } return true; @@ -80,14 +74,8 @@ public class PasswordChecker implements IPasswordCheck, IConfigPasswordCheck { */ public boolean isGoodPassword(String mPassword) { if (mPassword == null || mPassword.length() == 0) { - EPasswordCheckException e = new EPasswordCheckException( - CMS.getUserMessage("CMS_PASSWORD_EMPTY_PASSWORD")); - return false; } else if (mPassword.length() < MIN_LEN) { - EPasswordCheckException e = new EPasswordCheckException( - CMS.getUserMessage("CMS_PASSWORD_INVALID_LEN", "" + MIN_LEN)); - return false; } return true; diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/IssuerAltNameExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/IssuerAltNameExt.java index 21afaa188..bb9abd9cf 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/IssuerAltNameExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/IssuerAltNameExt.java @@ -153,9 +153,7 @@ public class IssuerAltNameExt extends APolicyRule X509CertInfo[] ci = req.getExtDataInCertInfoArray(IRequest.CERT_INFO); - X509CertInfo certInfo = null; - - if (ci == null || (certInfo = ci[0]) == null) { + if (ci == null || ci[0] == null) { setError(req, CMS.getUserMessage("CMS_POLICY_NO_CERT_INFO"), NAME); return PolicyResult.REJECTED; // unrecoverable error. } diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/NSCCommentExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/NSCCommentExt.java index f3ae4efa4..ecc084d29 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/NSCCommentExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/NSCCommentExt.java @@ -28,7 +28,6 @@ import java.util.Vector; import netscape.security.x509.CertificateExtensions; import netscape.security.x509.CertificateVersion; -import netscape.security.x509.DisplayText; import netscape.security.x509.NSCCommentExtension; import netscape.security.x509.X509CertInfo; @@ -233,9 +232,6 @@ public class NSCCommentExt extends APolicyRule certApplied = true; - DisplayText displayText = - new DisplayText(DisplayText.tag_IA5String, mUserNoticeDisplayText); - try { NSCCommentExtension cpExt = new NSCCommentExtension(mCritical, mUserNoticeDisplayText); diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/NSCertTypeExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/NSCertTypeExt.java index 8903535dd..2d521e8d5 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/NSCertTypeExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/NSCertTypeExt.java @@ -164,9 +164,7 @@ public class NSCertTypeExt extends APolicyRule X509CertInfo[] ci = req.getExtDataInCertInfoArray(IRequest.CERT_INFO); - X509CertInfo certInfo = null; - - if (ci == null || (certInfo = ci[0]) == null) { + if (ci == null || ci[0] == null) { setError(req, CMS.getUserMessage("CMS_POLICY_NO_CERT_INFO"), NAME); return PolicyResult.REJECTED; // unrecoverable error. } diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/PrivateKeyUsagePeriodExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/PrivateKeyUsagePeriodExt.java index 52c8f1f69..fe2565428 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/PrivateKeyUsagePeriodExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/PrivateKeyUsagePeriodExt.java @@ -136,12 +136,9 @@ public class PrivateKeyUsagePeriodExt extends APolicyRule mNotAfter = config.getString(PROP_NOT_AFTER, null); mCritical = config.getBoolean(PROP_IS_CRITICAL, false); - // Check the parameter formats - String notBefore; - String notAfter; - - notBefore = formatter.format(formatter.parse(mNotBefore.trim())); - notAfter = formatter.format(formatter.parse(mNotAfter.trim())); + // Check the parameter formats for errors + formatter.format(formatter.parse(mNotBefore.trim())); + formatter.format(formatter.parse(mNotAfter.trim())); } catch (Exception e) { // e.printStackTrace(); Object[] params = { getInstanceName(), e }; diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/SubjectDirectoryAttributesExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/SubjectDirectoryAttributesExt.java index 6c1c6a4e8..b4ebb4b45 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/SubjectDirectoryAttributesExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/SubjectDirectoryAttributesExt.java @@ -143,7 +143,6 @@ public class SubjectDirectoryAttributesExt extends APolicyRule public PolicyResult applyCert(IRequest req, X509CertInfo certInfo) { CertificateExtensions extensions = null; - SubjectDirAttributesExtension subjDirExt = null; try { // get extension and remove if exists. @@ -413,7 +412,7 @@ class AttributeConfig { while (n.hasMoreElements()) { sb.append(","); - sb.append((String) n.nextElement()); + sb.append(n.nextElement()); } return sb.toString(); } @@ -421,9 +420,9 @@ class AttributeConfig { private static void checkValue(ObjectIdentifier oid, String val) throws IOException { AVAValueConverter c = X500NameAttrMap.getDefault().getValueConverter(oid); - DerValue derval; - derval = c.getValue(val); // errs encountered will get thrown. + @SuppressWarnings("unused") + DerValue derval = c.getValue(val); // check for errors return; } diff --git a/pki/base/common/src/com/netscape/cms/profile/common/BasicProfile.java b/pki/base/common/src/com/netscape/cms/profile/common/BasicProfile.java index 941617121..cab594188 100644 --- a/pki/base/common/src/com/netscape/cms/profile/common/BasicProfile.java +++ b/pki/base/common/src/com/netscape/cms/profile/common/BasicProfile.java @@ -221,7 +221,7 @@ public abstract class BasicProfile implements IProfile { StringTokenizer input_st = new StringTokenizer(input_list, ","); while (input_st.hasMoreTokens()) { - String input_id = (String) input_st.nextToken(); + String input_id = input_st.nextToken(); String inputClassId = inputStore.getString(input_id + "." + PROP_CLASS_ID); IPluginInfo inputInfo = mRegistry.getPluginInfo("profileInput", @@ -251,7 +251,7 @@ public abstract class BasicProfile implements IProfile { StringTokenizer output_st = new StringTokenizer(output_list, ","); while (output_st.hasMoreTokens()) { - String output_id = (String) output_st.nextToken(); + String output_id = output_st.nextToken(); String outputClassId = outputStore.getString(output_id + "." + PROP_CLASS_ID); @@ -282,7 +282,7 @@ public abstract class BasicProfile implements IProfile { StringTokenizer updater_st = new StringTokenizer(updater_list, ","); while (updater_st.hasMoreTokens()) { - String updater_id = (String) updater_st.nextToken(); + String updater_id = updater_st.nextToken(); String updaterClassId = updaterStore.getString(updater_id + "." + PROP_CLASS_ID); @@ -313,14 +313,14 @@ public abstract class BasicProfile implements IProfile { StringTokenizer st = new StringTokenizer(setlist, ","); while (st.hasMoreTokens()) { - String setId = (String) st.nextToken(); + String setId = st.nextToken(); IConfigStore policyStore = policySetStore.getSubStore(setId); String list = policyStore.getString(PROP_POLICY_LIST, ""); StringTokenizer st1 = new StringTokenizer(list, ","); while (st1.hasMoreTokens()) { - String id = (String) st1.nextToken(); + String id = st1.nextToken(); String defaultRoot = id + "." + PROP_DEFAULT; String defaultClassId = policyStore.getString(defaultRoot + "." + @@ -350,7 +350,7 @@ public abstract class BasicProfile implements IProfile { } public IProfileUpdater getProfileUpdater(String name) { - return (IProfileUpdater) mUpdaters.get(name); + return mUpdaters.get(name); } public Enumeration<String> getProfileOutputIds() { @@ -358,7 +358,7 @@ public abstract class BasicProfile implements IProfile { } public IProfileOutput getProfileOutput(String name) { - return (IProfileOutput) mOutputs.get(name); + return mOutputs.get(name); } public Enumeration<String> getProfileInputIds() { @@ -366,7 +366,7 @@ public abstract class BasicProfile implements IProfile { } public IProfileInput getProfileInput(String name) { - return (IProfileInput) mInputs.get(name); + return mInputs.get(name); } public void addInputName(String name) { @@ -424,10 +424,9 @@ public abstract class BasicProfile implements IProfile { } int size = policies.size(); - boolean found = false; for (int i = 0; i < size; i++) { - ProfilePolicy policy = (ProfilePolicy) policies.elementAt(i); + ProfilePolicy policy = policies.elementAt(i); String id = policy.getId(); if (id.equals(policyId)) { @@ -481,10 +480,9 @@ public abstract class BasicProfile implements IProfile { newlist = newlist.substring(0, newlist.length() - 1); int size = mInputIds.size(); - boolean found = false; for (int i = 0; i < size; i++) { - String id = (String) mInputIds.elementAt(i); + String id = mInputIds.elementAt(i); if (id.equals(inputId)) { mInputIds.removeElementAt(i); @@ -522,10 +520,9 @@ public abstract class BasicProfile implements IProfile { newlist = newlist.substring(0, newlist.length() - 1); int size = mOutputIds.size(); - boolean found = false; for (int i = 0; i < size; i++) { - String id = (String) mOutputIds.elementAt(i); + String id = mOutputIds.elementAt(i); if (id.equals(outputId)) { mOutputIds.removeElementAt(i); @@ -621,7 +618,7 @@ public abstract class BasicProfile implements IProfile { Enumeration<String> enum1 = nvps.getNames(); while (enum1.hasMoreElements()) { - String name = (String) enum1.nextElement(); + String name = enum1.nextElement(); outputStore.putString(prefix + "params." + name, nvps.getValue(name)); try { @@ -724,7 +721,7 @@ public abstract class BasicProfile implements IProfile { Enumeration<String> enum1 = nvps.getNames(); while (enum1.hasMoreElements()) { - String name = (String) enum1.nextElement(); + String name = enum1.nextElement(); inputStore.putString(prefix + "params." + name, nvps.getValue(name)); try { @@ -781,7 +778,7 @@ public abstract class BasicProfile implements IProfile { Enumeration<String> keys = mPolicySet.keys(); while (keys.hasMoreElements()) { - String k = (String) keys.nextElement(); + String k = keys.nextElement(); if (!(setlist.toString()).equals("")) { setlist.append(","); @@ -836,7 +833,7 @@ public abstract class BasicProfile implements IProfile { int matches = 0; while (st.hasMoreTokens()) { - String sId = (String) st.nextToken(); + String sId = st.nextToken(); //Only search the setId set. Ex: encryptionCertSet if (!sId.equals(setId)) { @@ -854,7 +851,7 @@ public abstract class BasicProfile implements IProfile { StringTokenizer st1 = new StringTokenizer(list, ","); while (st1.hasMoreTokens()) { - String curId = (String) st1.nextToken(); + String curId = st1.nextToken(); String defaultRoot = curId + "." + PROP_DEFAULT; String curDefaultClassId = null; @@ -996,7 +993,7 @@ public abstract class BasicProfile implements IProfile { return null; for (int i = 0; i < policies.size(); i++) { - ProfilePolicy policy = (ProfilePolicy) policies.elementAt(i); + ProfilePolicy policy = policies.elementAt(i); if (policy.getId().equals(id)) { return policy; @@ -1060,7 +1057,7 @@ public abstract class BasicProfile implements IProfile { Enumeration<String> ids = getProfileInputIds(); while (ids.hasMoreElements()) { - String id = (String) ids.nextElement(); + String id = ids.nextElement(); IProfileInput input = getProfileInput(id); input.populate(ctx, request); @@ -1084,8 +1081,7 @@ public abstract class BasicProfile implements IProfile { CMS.debug("BasicProfile: populate() policy setid =" + setId); for (int i = 0; i < policies.size(); i++) { - ProfilePolicy policy = (ProfilePolicy) - policies.elementAt(i); + ProfilePolicy policy = policies.elementAt(i); policy.getDefault().populate(request); } @@ -1102,8 +1098,7 @@ public abstract class BasicProfile implements IProfile { Vector<ProfilePolicy> policies = getPolicies(setId); for (int i = 0; i < policies.size(); i++) { - ProfilePolicy policy = (ProfilePolicy) - policies.elementAt(i); + ProfilePolicy policy = policies.elementAt(i); policy.getConstraint().validate(request); } @@ -1129,8 +1124,7 @@ public abstract class BasicProfile implements IProfile { Vector<String> v = new Vector<String>(); for (int i = 0; i < policies.size(); i++) { - ProfilePolicy policy = (ProfilePolicy) - policies.elementAt(i); + ProfilePolicy policy = policies.elementAt(i); v.addElement(policy.getId()); } diff --git a/pki/base/common/src/com/netscape/cms/profile/common/CACertCAEnrollProfile.java b/pki/base/common/src/com/netscape/cms/profile/common/CACertCAEnrollProfile.java index cdaddef55..3ad301b26 100644 --- a/pki/base/common/src/com/netscape/cms/profile/common/CACertCAEnrollProfile.java +++ b/pki/base/common/src/com/netscape/cms/profile/common/CACertCAEnrollProfile.java @@ -20,11 +20,8 @@ package com.netscape.cms.profile.common; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.IConfigStore; import com.netscape.certsrv.common.NameValuePairs; -import com.netscape.certsrv.profile.IPolicyConstraint; import com.netscape.certsrv.profile.IPolicyDefault; import com.netscape.certsrv.profile.IProfileEx; -import com.netscape.certsrv.profile.IProfileInput; -import com.netscape.certsrv.profile.IProfileOutput; import com.netscape.certsrv.profile.IProfilePolicy; /** @@ -43,25 +40,18 @@ public class CACertCAEnrollProfile extends CAEnrollProfile public void populate() throws EBaseException { // create inputs NameValuePairs inputParams1 = new NameValuePairs(); - IProfileInput input1 = - createProfileInput("i1", "certReqInputImpl", inputParams1); + createProfileInput("i1", "certReqInputImpl", inputParams1); NameValuePairs inputParams2 = new NameValuePairs(); - IProfileInput input2 = - createProfileInput("i2", "submitterInfoInputImpl", inputParams2); + createProfileInput("i2", "submitterInfoInputImpl", inputParams2); // create outputs NameValuePairs outputParams1 = new NameValuePairs(); - IProfileOutput output1 = - createProfileOutput("o1", "certOutputImpl", outputParams1); + createProfileOutput("o1", "certOutputImpl", outputParams1); // create policies IProfilePolicy policy1 = createProfilePolicy("set1", "p1", "userSubjectNameDefaultImpl", "noConstraintImpl"); - IPolicyDefault def1 = policy1.getDefault(); - IConfigStore defConfig1 = def1.getConfigStore(); - IPolicyConstraint con1 = policy1.getConstraint(); - IConfigStore conConfig1 = con1.getConfigStore(); IProfilePolicy policy2 = createProfilePolicy("set1", "p2", @@ -70,8 +60,6 @@ public class CACertCAEnrollProfile extends CAEnrollProfile IConfigStore defConfig2 = def2.getConfigStore(); defConfig2.putString("params.range", "180"); defConfig2.putString("params.startTime", "0"); - IPolicyConstraint con2 = policy2.getConstraint(); - IConfigStore conConfig2 = con2.getConfigStore(); IProfilePolicy policy3 = createProfilePolicy("set1", "p3", @@ -81,8 +69,6 @@ public class CACertCAEnrollProfile extends CAEnrollProfile defConfig3.putString("params.keyType", "RSA"); defConfig3.putString("params.keyMinLength", "512"); defConfig3.putString("params.keyMaxLength", "4096"); - IPolicyConstraint con3 = policy3.getConstraint(); - IConfigStore conConfig3 = con3.getConfigStore(); IProfilePolicy policy4 = createProfilePolicy("set1", "p4", @@ -92,8 +78,6 @@ public class CACertCAEnrollProfile extends CAEnrollProfile defConfig4.putString("params.signingAlg", "-"); defConfig4.putString("params.signingAlgsAllowed", "SHA1withRSA,SHA256withRSA,SHA512withRSA,MD5withRSA,MD2withRSA,SHA256withEC,SHA384withEC,SHA512withEC"); - IPolicyConstraint con4 = policy4.getConstraint(); - IConfigStore conConfig4 = con4.getConfigStore(); // extensions IProfilePolicy policy5 = @@ -111,8 +95,6 @@ public class CACertCAEnrollProfile extends CAEnrollProfile defConfig5.putString("params.keyUsageKeyCertSign", "true"); defConfig5.putString("params.keyUsageKeyEncipherment", "false"); defConfig5.putString("params.keyUsageNonRepudiation", "true"); - IPolicyConstraint con5 = policy5.getConstraint(); - IConfigStore conConfig5 = con5.getConfigStore(); IProfilePolicy policy6 = createProfilePolicy("set1", "p6", @@ -122,7 +104,5 @@ public class CACertCAEnrollProfile extends CAEnrollProfile defConfig6.putString("params.basicConstraintsPathLen", "-1"); defConfig6.putString("params.basicConstraintsIsCA", "true"); defConfig6.putString("params.basicConstraintsPathLen", "-1"); - IPolicyConstraint con6 = policy6.getConstraint(); - IConfigStore conConfig6 = con6.getConfigStore(); } } diff --git a/pki/base/common/src/com/netscape/cms/profile/common/ServerCertCAEnrollProfile.java b/pki/base/common/src/com/netscape/cms/profile/common/ServerCertCAEnrollProfile.java index 8a00f3f32..9be1e43c4 100644 --- a/pki/base/common/src/com/netscape/cms/profile/common/ServerCertCAEnrollProfile.java +++ b/pki/base/common/src/com/netscape/cms/profile/common/ServerCertCAEnrollProfile.java @@ -20,11 +20,8 @@ package com.netscape.cms.profile.common; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.IConfigStore; import com.netscape.certsrv.common.NameValuePairs; -import com.netscape.certsrv.profile.IPolicyConstraint; import com.netscape.certsrv.profile.IPolicyDefault; import com.netscape.certsrv.profile.IProfileEx; -import com.netscape.certsrv.profile.IProfileInput; -import com.netscape.certsrv.profile.IProfileOutput; import com.netscape.certsrv.profile.IProfilePolicy; /** @@ -43,24 +40,16 @@ public class ServerCertCAEnrollProfile extends CAEnrollProfile public void populate() throws EBaseException { // create inputs NameValuePairs inputParams1 = new NameValuePairs(); - IProfileInput input1 = - createProfileInput("i1", "certReqInputImpl", inputParams1); + createProfileInput("i1", "certReqInputImpl", inputParams1); NameValuePairs inputParams2 = new NameValuePairs(); - IProfileInput input2 = - createProfileInput("i2", "submitterInfoInputImpl", inputParams2); + createProfileInput("i2", "submitterInfoInputImpl", inputParams2); // create outputs NameValuePairs outputParams1 = new NameValuePairs(); - IProfileOutput output1 = - createProfileOutput("o1", "certOutputImpl", outputParams1); + createProfileOutput("o1", "certOutputImpl", outputParams1); - IProfilePolicy policy1 = - createProfilePolicy("set1", "p1", + createProfilePolicy("set1", "p1", "userSubjectNameDefaultImpl", "noConstraintImpl"); - IPolicyDefault def1 = policy1.getDefault(); - IConfigStore defConfig1 = def1.getConfigStore(); - IPolicyConstraint con1 = policy1.getConstraint(); - IConfigStore conConfig1 = con1.getConfigStore(); IProfilePolicy policy2 = createProfilePolicy("set1", "p2", @@ -69,8 +58,6 @@ public class ServerCertCAEnrollProfile extends CAEnrollProfile IConfigStore defConfig2 = def2.getConfigStore(); defConfig2.putString("params.range", "180"); defConfig2.putString("params.startTime", "0"); - IPolicyConstraint con2 = policy2.getConstraint(); - IConfigStore conConfig2 = con2.getConfigStore(); IProfilePolicy policy3 = createProfilePolicy("set1", "p3", @@ -80,8 +67,6 @@ public class ServerCertCAEnrollProfile extends CAEnrollProfile defConfig3.putString("params.keyType", "RSA"); defConfig3.putString("params.keyMinLength", "512"); defConfig3.putString("params.keyMaxLength", "4096"); - IPolicyConstraint con3 = policy3.getConstraint(); - IConfigStore conConfig3 = con3.getConfigStore(); IProfilePolicy policy4 = createProfilePolicy("set1", "p4", @@ -93,8 +78,6 @@ public class ServerCertCAEnrollProfile extends CAEnrollProfile .putString( "params.signingAlgsAllowed", "SHA1withRSA,SHA256withRSA,SHA512withRSA,MD5withRSA,MD2withRSA,SHA1withEC,SHA256withEC,SHA384withEC,SHA512withEC"); - IPolicyConstraint con4 = policy4.getConstraint(); - IConfigStore conConfig4 = con4.getConfigStore(); IProfilePolicy policy5 = createProfilePolicy("set1", "p5", @@ -111,8 +94,6 @@ public class ServerCertCAEnrollProfile extends CAEnrollProfile defConfig5.putString("params.keyUsageKeyCertSign", "false"); defConfig5.putString("params.keyUsageKeyEncipherment", "true"); defConfig5.putString("params.keyUsageNonRepudiation", "true"); - IPolicyConstraint con5 = policy5.getConstraint(); - IConfigStore conConfig5 = con5.getConfigStore(); } diff --git a/pki/base/common/src/com/netscape/cms/profile/common/UserCertCAEnrollProfile.java b/pki/base/common/src/com/netscape/cms/profile/common/UserCertCAEnrollProfile.java index 69414707e..3f1cdfb21 100644 --- a/pki/base/common/src/com/netscape/cms/profile/common/UserCertCAEnrollProfile.java +++ b/pki/base/common/src/com/netscape/cms/profile/common/UserCertCAEnrollProfile.java @@ -20,11 +20,8 @@ package com.netscape.cms.profile.common; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.IConfigStore; import com.netscape.certsrv.common.NameValuePairs; -import com.netscape.certsrv.profile.IPolicyConstraint; import com.netscape.certsrv.profile.IPolicyDefault; import com.netscape.certsrv.profile.IProfileEx; -import com.netscape.certsrv.profile.IProfileInput; -import com.netscape.certsrv.profile.IProfileOutput; import com.netscape.certsrv.profile.IProfilePolicy; /** @@ -43,28 +40,18 @@ public class UserCertCAEnrollProfile extends CAEnrollProfile public void populate() throws EBaseException { // create inputs NameValuePairs inputParams1 = new NameValuePairs(); - IProfileInput input1 = - createProfileInput("i1", "keyGenInputImpl", inputParams1); + createProfileInput("i1", "keyGenInputImpl", inputParams1); NameValuePairs inputParams2 = new NameValuePairs(); - IProfileInput input2 = - createProfileInput("i2", "subjectNameInputImpl", inputParams2); - NameValuePairs inputParams3 = new NameValuePairs(); - IProfileInput input3 = - createProfileInput("i3", "submitterInfoInputImpl", inputParams2); + createProfileInput("i2", "subjectNameInputImpl", inputParams2); + createProfileInput("i3", "submitterInfoInputImpl", inputParams2); // create outputs NameValuePairs outputParams1 = new NameValuePairs(); - IProfileOutput output1 = - createProfileOutput("o1", "certOutputImpl", outputParams1); + createProfileOutput("o1", "certOutputImpl", outputParams1); // create policies - IProfilePolicy policy1 = - createProfilePolicy("set1", "p1", + createProfilePolicy("set1", "p1", "userSubjectNameDefaultImpl", "noConstraintImpl"); - IPolicyDefault def1 = policy1.getDefault(); - IConfigStore defConfig1 = def1.getConfigStore(); - IPolicyConstraint con1 = policy1.getConstraint(); - IConfigStore conConfig1 = con1.getConfigStore(); IProfilePolicy policy2 = createProfilePolicy("set1", "p2", @@ -73,8 +60,6 @@ public class UserCertCAEnrollProfile extends CAEnrollProfile IConfigStore defConfig2 = def2.getConfigStore(); defConfig2.putString("params.range", "180"); defConfig2.putString("params.startTime", "0"); - IPolicyConstraint con2 = policy2.getConstraint(); - IConfigStore conConfig2 = con2.getConfigStore(); IProfilePolicy policy3 = createProfilePolicy("set1", "p3", @@ -84,8 +69,6 @@ public class UserCertCAEnrollProfile extends CAEnrollProfile defConfig3.putString("params.keyType", "RSA"); defConfig3.putString("params.keyMinLength", "512"); defConfig3.putString("params.keyMaxLength", "4096"); - IPolicyConstraint con3 = policy3.getConstraint(); - IConfigStore conConfig3 = con3.getConfigStore(); IProfilePolicy policy4 = createProfilePolicy("set1", "p4", @@ -97,8 +80,6 @@ public class UserCertCAEnrollProfile extends CAEnrollProfile .putString( "params.signingAlgsAllowed", "SHA1withRSA,SHA256withRSA,SHA512withRSA,MD5withRSA,MD2withRSA,SHA1withEC,SHA256withEC,SHA384withEC,SHA512withEC"); - IPolicyConstraint con4 = policy4.getConstraint(); - IConfigStore conConfig4 = con4.getConfigStore(); IProfilePolicy policy5 = createProfilePolicy("set1", "p5", @@ -115,7 +96,5 @@ public class UserCertCAEnrollProfile extends CAEnrollProfile defConfig5.putString("params.keyUsageKeyCertSign", "false"); defConfig5.putString("params.keyUsageKeyEncipherment", "true"); defConfig5.putString("params.keyUsageNonRepudiation", "true"); - IPolicyConstraint con5 = policy5.getConstraint(); - IConfigStore conConfig5 = con5.getConfigStore(); } } diff --git a/pki/base/common/src/com/netscape/cms/profile/constraint/BasicConstraintsExtConstraint.java b/pki/base/common/src/com/netscape/cms/profile/constraint/BasicConstraintsExtConstraint.java index 303522781..f924c587f 100644 --- a/pki/base/common/src/com/netscape/cms/profile/constraint/BasicConstraintsExtConstraint.java +++ b/pki/base/common/src/com/netscape/cms/profile/constraint/BasicConstraintsExtConstraint.java @@ -21,7 +21,6 @@ import java.io.IOException; import java.util.Locale; import netscape.security.x509.BasicConstraintsExtension; -import netscape.security.x509.CertificateExtensions; import netscape.security.x509.PKIXExtensions; import netscape.security.x509.X509CertInfo; @@ -100,7 +99,6 @@ public class BasicConstraintsExtConstraint extends EnrollConstraint { */ public void validate(IRequest request, X509CertInfo info) throws ERejectException { - CertificateExtensions exts = null; try { BasicConstraintsExtension ext = (BasicConstraintsExtension) diff --git a/pki/base/common/src/com/netscape/cms/profile/def/FreshestCRLExtDefault.java b/pki/base/common/src/com/netscape/cms/profile/def/FreshestCRLExtDefault.java index d5ac9247d..a2de3f491 100644 --- a/pki/base/common/src/com/netscape/cms/profile/def/FreshestCRLExtDefault.java +++ b/pki/base/common/src/com/netscape/cms/profile/def/FreshestCRLExtDefault.java @@ -28,7 +28,6 @@ import netscape.security.x509.GeneralName; import netscape.security.x509.GeneralNames; import netscape.security.x509.GeneralNamesException; import netscape.security.x509.PKIXExtensions; -import netscape.security.x509.RDN; import netscape.security.x509.X509CertInfo; import com.netscape.certsrv.apps.CMS; @@ -423,7 +422,6 @@ public class FreshestCRLExtDefault extends EnrollExtDefault { NameValuePairs pairs = new NameValuePairs(); - RDN rdn = null; boolean hasFullName = false; pairs.add(ENABLE, "true"); diff --git a/pki/base/common/src/com/netscape/cms/profile/def/SubjectDirAttributesExtDefault.java b/pki/base/common/src/com/netscape/cms/profile/def/SubjectDirAttributesExtDefault.java index 29562123e..a706fb4ad 100644 --- a/pki/base/common/src/com/netscape/cms/profile/def/SubjectDirAttributesExtDefault.java +++ b/pki/base/common/src/com/netscape/cms/profile/def/SubjectDirAttributesExtDefault.java @@ -217,7 +217,6 @@ public class SubjectDirAttributesExtDefault extends EnrollExtDefault { boolean critical = ext.isCritical(); - X500NameAttrMap map = X500NameAttrMap.getDefault(); Vector<Attribute> attrV = new Vector<Attribute>(); for (int i = 0; i < size; i++) { NameValuePairs nvps = v.elementAt(i); @@ -511,9 +510,9 @@ class AttributeConfig { private static void checkValue(ObjectIdentifier oid, String val) throws IOException { AVAValueConverter c = X500NameAttrMap.getDefault().getValueConverter(oid); - DerValue derval; - derval = c.getValue(val); // errs encountered will get thrown. + @SuppressWarnings("unused") + DerValue derval = c.getValue(val); // check for errors return; } diff --git a/pki/base/common/src/com/netscape/cms/publish/mappers/LdapCaSimpleMap.java b/pki/base/common/src/com/netscape/cms/publish/mappers/LdapCaSimpleMap.java index 89f1ab8ee..abdc770ba 100644 --- a/pki/base/common/src/com/netscape/cms/publish/mappers/LdapCaSimpleMap.java +++ b/pki/base/common/src/com/netscape/cms/publish/mappers/LdapCaSimpleMap.java @@ -145,8 +145,6 @@ public class LdapCaSimpleMap implements ILdapMapper, IExtendedPluginInfo { mDnPattern = DEFAULT_DNPATTERN; try { mPattern = new MapDNPattern(mDnPattern); - String[] mReqAttrs = mPattern.getReqAttrs(); - String[] mCertAttrs = mPattern.getCertAttrs(); } catch (ELdapException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("PUBLISH_DN_PATTERN_INIT", dnPattern, e.toString())); throw new EBaseException("falied to init with pattern " + diff --git a/pki/base/common/src/com/netscape/cms/publish/mappers/LdapCertExactMap.java b/pki/base/common/src/com/netscape/cms/publish/mappers/LdapCertExactMap.java index 33c186c14..11b53a797 100644 --- a/pki/base/common/src/com/netscape/cms/publish/mappers/LdapCertExactMap.java +++ b/pki/base/common/src/com/netscape/cms/publish/mappers/LdapCertExactMap.java @@ -137,8 +137,6 @@ public class LdapCertExactMap implements ILdapMapper, IExtendedPluginInfo { } } try { - boolean hasCert = false; - boolean hasSubjectName = false; String[] attrs = new String[] { LDAPv3.NO_ATTRS }; log(ILogger.LL_INFO, "Searching for " + subjectDN.toString()); diff --git a/pki/base/common/src/com/netscape/cms/publish/mappers/LdapCertSubjMap.java b/pki/base/common/src/com/netscape/cms/publish/mappers/LdapCertSubjMap.java index 15f845cb6..4d5ff38c8 100644 --- a/pki/base/common/src/com/netscape/cms/publish/mappers/LdapCertSubjMap.java +++ b/pki/base/common/src/com/netscape/cms/publish/mappers/LdapCertSubjMap.java @@ -205,8 +205,6 @@ public class LdapCertSubjMap implements ILdapMapper, IExtendedPluginInfo { } } try { - boolean hasCert = false; - boolean hasSubjectName = false; String[] attrs = new String[] { LDAPv3.NO_ATTRS }; log(ILogger.LL_INFO, "search " + mSearchBase + @@ -280,8 +278,6 @@ public class LdapCertSubjMap implements ILdapMapper, IExtendedPluginInfo { return v; } try { - boolean hasCert = false; - boolean hasSubjectName = false; String[] attrs = new String[] { LDAPv3.NO_ATTRS }; log(ILogger.LL_INFO, "search " + mSearchBase + diff --git a/pki/base/common/src/com/netscape/cms/publish/mappers/LdapEnhancedMap.java b/pki/base/common/src/com/netscape/cms/publish/mappers/LdapEnhancedMap.java index 7fd2bb44e..c9a7f867c 100644 --- a/pki/base/common/src/com/netscape/cms/publish/mappers/LdapEnhancedMap.java +++ b/pki/base/common/src/com/netscape/cms/publish/mappers/LdapEnhancedMap.java @@ -192,8 +192,6 @@ public class LdapEnhancedMap try { mPattern = new MapDNPattern(mDnPattern); - String[] mReqAttrs = mPattern.getReqAttrs(); - String[] mCertAttrs = mPattern.getCertAttrs(); } catch (ELdapException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("PUBLISH_DN_PATTERN_INIT", diff --git a/pki/base/common/src/com/netscape/cms/publish/mappers/LdapSimpleMap.java b/pki/base/common/src/com/netscape/cms/publish/mappers/LdapSimpleMap.java index b3177787f..642729673 100644 --- a/pki/base/common/src/com/netscape/cms/publish/mappers/LdapSimpleMap.java +++ b/pki/base/common/src/com/netscape/cms/publish/mappers/LdapSimpleMap.java @@ -138,8 +138,6 @@ public class LdapSimpleMap implements ILdapMapper, IExtendedPluginInfo { mDnPattern = DEFAULT_DNPATTERN; try { mPattern = new MapDNPattern(mDnPattern); - String[] mReqAttrs = mPattern.getReqAttrs(); - String[] mCertAttrs = mPattern.getCertAttrs(); } catch (ELdapException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("PUBLISH_DN_PATTERN_INIT", dnPattern, e.toString())); diff --git a/pki/base/common/src/com/netscape/cms/publish/publishers/OCSPPublisher.java b/pki/base/common/src/com/netscape/cms/publish/publishers/OCSPPublisher.java index 551bb4d6f..80abd5f77 100644 --- a/pki/base/common/src/com/netscape/cms/publish/publishers/OCSPPublisher.java +++ b/pki/base/common/src/com/netscape/cms/publish/publishers/OCSPPublisher.java @@ -95,8 +95,8 @@ public class OCSPPublisher implements ILdapPublisher, IExtendedPluginInfo { /** * Returns the current instance parameters. */ - public Vector getInstanceParams() { - Vector v = new Vector(); + public Vector<String> getInstanceParams() { + Vector<String> v = new Vector<String>(); String host = ""; String port = ""; String path = ""; @@ -134,8 +134,8 @@ public class OCSPPublisher implements ILdapPublisher, IExtendedPluginInfo { /** * Returns the initial default parameters. */ - public Vector getDefaultParams() { - Vector v = new Vector(); + public Vector<String> getDefaultParams() { + Vector<String> v = new Vector<String>(); IConfigStore config = CMS.getConfigStore(); String nickname = ""; @@ -301,7 +301,6 @@ public class OCSPPublisher implements ILdapPublisher, IExtendedPluginInfo { ILogger.LL_INFO, "OCSPPublisher: start getting response"); DataInputStream dis = new DataInputStream(socket.getInputStream()); String nextline; - String line = ""; String error = ""; boolean status = false; diff --git a/pki/base/common/src/com/netscape/cms/selftests/tks/TKSKnownSessionKey.java b/pki/base/common/src/com/netscape/cms/selftests/tks/TKSKnownSessionKey.java index a1298727c..69edeb24f 100644 --- a/pki/base/common/src/com/netscape/cms/selftests/tks/TKSKnownSessionKey.java +++ b/pki/base/common/src/com/netscape/cms/selftests/tks/TKSKnownSessionKey.java @@ -88,7 +88,6 @@ public class TKSKnownSessionKey EMissingSelfTestException { ISubsystem tks = null; IConfigStore tksConfig = null; - String logMessage = null; super.initSelfTest(subsystem, instanceName, parameters); diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/AdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/AdminServlet.java index e02189142..8f1024723 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/AdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/AdminServlet.java @@ -290,7 +290,6 @@ public class AdminServlet extends HttpServlet { IOException { String auditMessage = null; - String auditSubjectID = ILogger.UNIDENTIFIED; String auditUID = ILogger.UNIDENTIFIED; String authType = ""; diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/AuthAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/AuthAdminServlet.java index d1924aa93..6a7ad9599 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/AuthAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/AuthAdminServlet.java @@ -1204,9 +1204,7 @@ public class AuthAdminServlet extends AdminServlet { // only remove from memory // cannot shutdown because we don't keep track of whether it's // being used. - IAuthManager mgrInst = (IAuthManager) mAuths.get(id); - - mAuths.getInstances().remove((Object) id); + mAuths.getInstances().remove(id); // remove the configuration. IConfigStore destStore = diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/CAAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/CAAdminServlet.java index 2c6ba3dbc..5bcaa46d2 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/CAAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/CAAdminServlet.java @@ -32,7 +32,6 @@ import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.IConfigStore; import com.netscape.certsrv.base.IExtendedPluginInfo; -import com.netscape.certsrv.base.ISubsystem; import com.netscape.certsrv.ca.ICMSCRLExtensions; import com.netscape.certsrv.ca.ICRLIssuingPoint; import com.netscape.certsrv.ca.ICertificateAuthority; @@ -348,9 +347,6 @@ public class CAAdminServlet extends AdminServlet { if ((!template.exists()) || (!template.canRead()) || (template.isDirectory())) { - String error = - "Template: " + val + " does not exist or invalid"; - log(ILogger.LL_FAILURE, CMS.getLogMessage("ADMIN_SRVLT_INVALID_PATH")); sendResponse(ERROR, @@ -404,9 +400,6 @@ public class CAAdminServlet extends AdminServlet { if ((!template.exists()) || (!template.canRead()) || (template.isDirectory())) { - String error = - "Template: " + val + " does not exist or invalid"; - log(ILogger.LL_FAILURE, CMS.getLogMessage("ADMIN_SRVLT_INVALID_PATH")); sendResponse(ERROR, @@ -1535,16 +1528,12 @@ public class CAAdminServlet extends AdminServlet { HttpServletResponse resp) throws ServletException, IOException, EBaseException { - ISubsystem eeGateway = null; - /* ISubsystem eeGateway = SubsystemRegistry.getInstance().get("eeGateway"); */ - IConfigStore eeConfig = null; - - IConfigStore caConfig = mCA.getConfigStore(); + @SuppressWarnings("unchecked") Enumeration<String> enum1 = req.getParameterNames(); boolean restart = false; 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 b77de59c6..6161a20d6 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 @@ -62,7 +62,6 @@ import com.netscape.certsrv.common.Constants; import com.netscape.certsrv.common.NameValuePairs; import com.netscape.certsrv.common.OpDef; import com.netscape.certsrv.common.ScopeDef; -import com.netscape.certsrv.dbs.IDBSubsystem; import com.netscape.certsrv.dbs.certdb.ICertRecord; import com.netscape.certsrv.dbs.certdb.ICertificateRepository; import com.netscape.certsrv.kra.IKeyRecoveryAuthority; @@ -357,7 +356,6 @@ public final class CMSAdminServlet extends AdminServlet { Enumeration<ISubsystem> e = CMS.getSubsystems(); while (e.hasMoreElements()) { - String type = ""; ISubsystem sys = (ISubsystem) e.nextElement(); //get subsystem type @@ -386,11 +384,8 @@ public final class CMSAdminServlet extends AdminServlet { boolean isCAInstalled = false; boolean isRAInstalled = false; boolean isKRAInstalled = false; - boolean isOCSPInstalled = false; - boolean isTKSInstalled = false; while (e.hasMoreElements()) { - String type = ""; ISubsystem sys = (ISubsystem) e.nextElement(); //get subsystem type @@ -400,10 +395,6 @@ public final class CMSAdminServlet extends AdminServlet { isRAInstalled = true; else if (sys instanceof ICertificateAuthority) isCAInstalled = true; - else if (sys instanceof IOCSPAuthority) - isOCSPInstalled = true; - else if (sys instanceof ITKSAuthority) - isTKSInstalled = true; } @@ -469,10 +460,7 @@ public final class CMSAdminServlet extends AdminServlet { params.add(Constants.PR_CERT_TRANS, getCertNickname(kraNickname)); } - if (isTKSInstalled) { - ITKSAuthority tks = (ITKSAuthority) - CMS.getSubsystem(CMS.SUBSYSTEM_TKS); - } + String nickName = CMS.getServerCertNickname(); params.add(Constants.PR_CERT_SERVER, getCertNickname(nickName)); @@ -547,11 +535,8 @@ public final class CMSAdminServlet extends AdminServlet { boolean isCAInstalled = false; boolean isRAInstalled = false; boolean isKRAInstalled = false; - boolean isOCSPInstalled = false; - boolean isTKSInstalled = false; while (e.hasMoreElements()) { - String type = ""; ISubsystem sys = (ISubsystem) e.nextElement(); //get subsystem type @@ -561,16 +546,11 @@ public final class CMSAdminServlet extends AdminServlet { isRAInstalled = true; else if (sys instanceof ICertificateAuthority) isCAInstalled = true; - else if (sys instanceof IOCSPAuthority) - isOCSPInstalled = true; - else if (sys instanceof ITKSAuthority) - isTKSInstalled = true; } ICertificateAuthority ca = null; IRegistrationAuthority ra = null; IKeyRecoveryAuthority kra = null; - ITKSAuthority tks = null; if (isCAInstalled) ca = (ICertificateAuthority) CMS.getSubsystem(CMS.SUBSYSTEM_CA); @@ -578,8 +558,6 @@ public final class CMSAdminServlet extends AdminServlet { ra = (IRegistrationAuthority) CMS.getSubsystem(CMS.SUBSYSTEM_RA); if (isKRAInstalled) kra = (IKeyRecoveryAuthority) CMS.getSubsystem(CMS.SUBSYSTEM_KRA); - if (isTKSInstalled) - tks = (ITKSAuthority) CMS.getSubsystem(CMS.SUBSYSTEM_TKS); boolean isCACert = true; @@ -906,7 +884,7 @@ public final class CMSAdminServlet extends AdminServlet { } if (selectedToken != null && newKeyName != null) { - String symKeys = SessionKey.GenMasterKey(selectedToken, newKeyName); + SessionKey.GenMasterKey(selectedToken, newKeyName); // check for errors CMS.getConfigStore().putString("tks.defaultSlot", selectedToken); String masterKeyPrefix = CMS.getConfigStore().getString("tks.master_key_prefix", null); @@ -934,9 +912,6 @@ public final class CMSAdminServlet extends AdminServlet { if (name.equals(Constants.PR_TOKEN_LIST)) { String selectedToken = req.getParameter(name); - int count = 0; - int keys_found = 0; - ICryptoSubsystem jssSubSystem = (ICryptoSubsystem) CMS.getSubsystem(CMS.SUBSYSTEM_CRYPTO); CryptoToken token = null; @@ -1125,9 +1100,7 @@ public final class CMSAdminServlet extends AdminServlet { String certType = Constants.PR_CA_SIGNING_CERT; String dir = ""; String pathname = ""; - String serverID = ""; String otherNickname = ""; - String certSubType = ""; String keyCurveName = ""; while (enum1.hasMoreElements()) { @@ -1145,12 +1118,8 @@ public final class CMSAdminServlet extends AdminServlet { certType = value; } else if (key.equals(Constants.PR_SUBJECT_NAME)) { subjectName = value; - } else if (key.equals(Constants.PR_SERVER_ID)) { - serverID = value; } else if (key.equals(Constants.PR_NICKNAME)) { otherNickname = value; - } else if (key.equals(Constants.PR_CERTIFICATE_SUBTYPE)) { - certSubType = value; } else if (key.equals(Constants.PR_KEY_CURVENAME)) { keyCurveName = value; } @@ -1495,27 +1464,17 @@ public final class CMSAdminServlet extends AdminServlet { try { @SuppressWarnings("unchecked") Enumeration<String> enum1 = req.getParameterNames(); - String pkcs = ""; - String type = ""; String tokenName = Constants.PR_INTERNAL_TOKEN_NAME; String keyType = "RSA"; - int keyLength = 512; - String subjectName = ""; KeyCertData properties = new KeyCertData(); - String pathname = ""; - String configPath = ""; String newtokenname = null; while (enum1.hasMoreElements()) { String key = (String) enum1.nextElement(); String value = req.getParameter(key); - if (key.equals("pathname")) { - configPath = mConfig.getString("instanceRoot", "") - + File.separator + "conf" + File.separator; - pathname = configPath + value; - } else { + if (!key.equals("pathname")) { if (key.equals(Constants.PR_TOKEN_NAME)) newtokenname = value; properties.put(key, value); @@ -1526,8 +1485,6 @@ public final class CMSAdminServlet extends AdminServlet { ICryptoSubsystem jssSubSystem = (ICryptoSubsystem) CMS.getSubsystem(CMS.SUBSYSTEM_CRYPTO); - IDBSubsystem dbs = (IDBSubsystem) - CMS.getSubsystem(CMS.SUBSYSTEM_DBS); ICertificateAuthority ca = (ICertificateAuthority) CMS.getSubsystem(CMS.SUBSYSTEM_CA); ICertificateRepository repository = @@ -1633,11 +1590,11 @@ public final class CMSAdminServlet extends AdminServlet { } else if (properties.getKeyLength() != null) { //new RSA or DSA keyType = properties.getKeyType(); String keyLen = properties.getKeyLength(); - PQGParams pqgParams = null; if (keyType.equals("DSA")) { - pqgParams = jssSubSystem.getCAPQG(Integer.parseInt(keyLen), - mConfig); + @SuppressWarnings("unused") + PQGParams pqgParams = + jssSubSystem.getCAPQG(Integer.parseInt(keyLen), mConfig); // check for errors //properties.put(Constants.PR_PQGPARAMS, pqgParams); } pair = jssSubSystem.getKeyPair(properties); @@ -2342,7 +2299,6 @@ public final class CMSAdminServlet extends AdminServlet { // to the signed audit log and stored as failures try { String b64Cert = ""; - String certType = ""; String pathname = ""; String serverRoot = ""; String serverID = ""; @@ -2358,8 +2314,6 @@ public final class CMSAdminServlet extends AdminServlet { // really should be PR_CERT_CONTENT if (key.equals(Constants.PR_PKCS10)) b64Cert = value; - else if (key.equals(Constants.RS_ID)) - certType = value; else if (key.equals("pathname")) pathname = value; else if (key.equals(Constants.PR_SERVER_ROOT)) @@ -2724,7 +2678,6 @@ public final class CMSAdminServlet extends AdminServlet { String nickname = ""; String serialno = ""; String issuername = ""; - Locale locale = super.getLocale(req); NameValuePairs pairs = new NameValuePairs(); while (enum1.hasMoreElements()) { @@ -2888,31 +2841,7 @@ public final class CMSAdminServlet extends AdminServlet { private void validateKeyLength(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException, EBaseException { - @SuppressWarnings("unchecked") - Enumeration<String> enum1 = req.getParameterNames(); - String keyType = "RSA"; - String keyLen = "512"; - String certType = ""; - - while (enum1.hasMoreElements()) { - String key = (String) enum1.nextElement(); - String value = req.getParameter(key); - - if (key.equals(Constants.PR_CERTIFICATE_TYPE)) { - certType = value; - } else if (key.equals(Constants.PR_KEY_TYPE)) { - keyType = value; - } else if (key.equals(Constants.PR_KEY_LENGTH)) { - keyLen = value; - } - } - int keyLength = Integer.parseInt(keyLen); - int minKey = mConfig.getInteger( - ConfigConstants.PR_RSA_MIN_KEYLENGTH, 512); - ICryptoSubsystem jssSubSystem = (ICryptoSubsystem) - CMS.getSubsystem(CMS.SUBSYSTEM_CRYPTO); - // jssSubSystem.checkKeyLength(keyType, keyLength, certType, minKey); sendResponse(SUCCESS, null, null, resp); } @@ -2979,17 +2908,12 @@ public final class CMSAdminServlet extends AdminServlet { Enumeration<String> enum1 = req.getParameterNames(); String nickname = ""; - String keyType = "RSA"; - String keyLen = "512"; - String certType = ""; - String configDir = ""; while (enum1.hasMoreElements()) { String key = (String) enum1.nextElement(); String value = req.getParameter(key); if (key.equals(Constants.RS_ID)) { - certType = value; nickname = getNickname(value); break; } @@ -3011,10 +2935,6 @@ public final class CMSAdminServlet extends AdminServlet { Enumeration<String> enum1 = req.getParameterNames(); String nickname = ""; - String keyType = "RSA"; - String keyLen = "512"; - String certType = ""; - String configDir = ""; while (enum1.hasMoreElements()) { String key = (String) enum1.nextElement(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/JobsAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/JobsAdminServlet.java index bfd5004a2..a9baa874c 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/JobsAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/JobsAdminServlet.java @@ -640,9 +640,7 @@ public class JobsAdminServlet extends AdminServlet { // only remove from memory // cannot shutdown because we don't keep track of whether it's // being used. - IJob jobInst = (IJob) mJobsSched.getInstances().get(id); - - mJobsSched.getInstances().remove((Object) id); + mJobsSched.getInstances().remove(id); // remove the configuration. IConfigStore destStore = diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/LogAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/LogAdminServlet.java index dadbf4088..ff70a5c53 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/LogAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/LogAdminServlet.java @@ -2352,7 +2352,7 @@ public class LogAdminServlet extends AdminServlet { } } else if (key.equals(Constants.PR_DEBUG_LOG_LEVEL)) { try { - int number = Integer.parseInt(value); + Integer.parseInt(value); // check for errors mConfig.putString(Constants.PR_DEBUG_LOG_LEVEL, value); } catch (NumberFormatException e) { CMS.debug("setGeneralConfig: Invalid value for " + Constants.PR_DEBUG_LOG_LEVEL + ": " + value); 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 cbc406997..8e67c3402 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 @@ -210,7 +210,6 @@ public class ProfileAdminServlet extends AdminServlet { throws ServletException, IOException { // Get operation type String op = req.getParameter(Constants.OP_TYPE); - String scope = super.getParameter(req, Constants.OP_SCOPE); if (op.equals(OpDef.OP_READ)) { if (!readAuthorize(req, resp)) @@ -232,7 +231,6 @@ public class ProfileAdminServlet extends AdminServlet { throws ServletException, IOException { // Get operation type String op = req.getParameter(Constants.OP_TYPE); - String scope = super.getParameter(req, Constants.OP_SCOPE); if (op.equals(OpDef.OP_READ)) { if (!readAuthorize(req, resp)) @@ -460,8 +458,6 @@ public class ProfileAdminServlet extends AdminServlet { String setId = ss.nextToken(); String pId = ss.nextToken(); - IProfilePolicy policy = null; - try { if (!isValidId(setId)) { sendResponse(ERROR, @@ -479,7 +475,7 @@ public class ProfileAdminServlet extends AdminServlet { null, resp); return; } - policy = profile.createProfilePolicy(setId, pId, + profile.createProfilePolicy(setId, pId, defImpl, conImpl); } catch (EBaseException e1) { // error @@ -590,7 +586,6 @@ public class ProfileAdminServlet extends AdminServlet { return; } - IProfileInput input = null; @SuppressWarnings("unchecked") Enumeration<String> names = req.getParameterNames(); NameValuePairs nvps = new NameValuePairs(); @@ -608,7 +603,7 @@ public class ProfileAdminServlet extends AdminServlet { } try { - input = profile.createProfileInput(inputId, inputImpl, nvps); + profile.createProfileInput(inputId, inputImpl, nvps); } catch (EBaseException e1) { // error @@ -717,7 +712,6 @@ public class ProfileAdminServlet extends AdminServlet { return; } - IProfileOutput output = null; @SuppressWarnings("unchecked") Enumeration<String> names = req.getParameterNames(); NameValuePairs nvps = new NameValuePairs(); @@ -735,7 +729,7 @@ public class ProfileAdminServlet extends AdminServlet { } try { - output = profile.createProfileOutput(outputId, outputImpl, + profile.createProfileOutput(outputId, outputImpl, nvps); } catch (EBaseException e1) { // error @@ -1207,7 +1201,6 @@ public class ProfileAdminServlet extends AdminServlet { IProfilePolicy policy = profile.getProfilePolicy(setId, pId); IPolicyDefault def = policy.getDefault(); - IConfigStore defConfig = def.getConfigStore(); @SuppressWarnings("unchecked") Enumeration<String> names = req.getParameterNames(); @@ -1345,7 +1338,6 @@ public class ProfileAdminServlet extends AdminServlet { IProfilePolicy policy = profile.getProfilePolicy(setId, pId); IPolicyConstraint con = policy.getConstraint(); - IConfigStore conConfig = con.getConfigStore(); @SuppressWarnings("unchecked") Enumeration<String> names = req.getParameterNames(); @@ -1484,7 +1476,6 @@ public class ProfileAdminServlet extends AdminServlet { String pId = ss.nextToken(); IProfilePolicy policy = profile.getProfilePolicy(setId, pId); IPolicyDefault def = policy.getDefault(); - IConfigStore defConfig = def.getConfigStore(); @SuppressWarnings("unchecked") Enumeration<String> names = req.getParameterNames(); @@ -1858,7 +1849,6 @@ public class ProfileAdminServlet extends AdminServlet { String pId = ss.nextToken(); IProfilePolicy policy = profile.getProfilePolicy(setId, pId); IPolicyConstraint con = policy.getConstraint(); - IConfigStore conConfig = con.getConfigStore(); @SuppressWarnings("unchecked") Enumeration<String> names = req.getParameterNames(); @@ -2072,9 +2062,7 @@ public class ProfileAdminServlet extends AdminServlet { while (policies.hasMoreElements()) { IProfilePolicy policy = (IProfilePolicy) policies.nextElement(); IPolicyDefault def = policy.getDefault(); - IConfigStore defConfig = def.getConfigStore(); IPolicyConstraint con = policy.getConstraint(); - IConfigStore conConfig = con.getConfigStore(); nvp.add(setId + ":" + policy.getId(), def.getName(getLocale(req)) + ";" + @@ -2230,13 +2218,6 @@ public class ProfileAdminServlet extends AdminServlet { while (e.hasMoreElements()) { String profileId = e.nextElement(); - IProfile profile = null; - - try { - profile = mProfileSub.getProfile(profileId); - } catch (EBaseException e1) { - // error - } String status = null; @@ -2480,7 +2461,6 @@ public class ProfileAdminServlet extends AdminServlet { String impl = req.getParameter("impl"); String name = req.getParameter("name"); - String desc = req.getParameter("desc"); String visible = req.getParameter("visible"); String auth = req.getParameter("auth"); String config = null; 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 a48b8146c..041818d0a 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 @@ -1014,7 +1014,7 @@ public abstract class CMSServlet extends HttpServlet { Enumeration<String> names = httpParams.elements(); while (names.hasMoreElements()) { - String name = (String) names.nextElement(); + String name = names.nextElement(); Enumeration<String> params = mDontSaveHttpParams.elements(); boolean dosave = true; @@ -1049,7 +1049,7 @@ public abstract class CMSServlet extends HttpServlet { return null; } ICertificateRepository certdb = - (ICertificateRepository) ((ICertificateAuthority) mAuthority).getCertificateRepository(); + ((ICertificateAuthority) mAuthority).getCertificateRepository(); if (certdb == null) { log(ILogger.LL_WARN, CMS.getLogMessage("CMSGW_CERT_DB_NULL", mAuthority.toString())); @@ -1104,7 +1104,7 @@ public abstract class CMSServlet extends HttpServlet { return null; } ICertificateRepository certdb = - (ICertificateRepository) ((ICertificateAuthority) mAuthority).getCertificateRepository(); + ((ICertificateAuthority) mAuthority).getCertificateRepository(); if (certdb == null) { log(ILogger.LL_WARN, CMS.getLogMessage("CMSGW_CERT_DB_NULL", mAuthority.toString())); @@ -1443,7 +1443,7 @@ public abstract class CMSServlet extends HttpServlet { if (token != null && req != null) { Enumeration<String> e = token.getElements(); while (e.hasMoreElements()) { - String n = (String) e.nextElement(); + String n = e.nextElement(); String[] x1 = token.getInStringArray(n); if (x1 != null) { for (int i = 0; i < x1.length; i++) { @@ -2141,7 +2141,7 @@ public abstract class CMSServlet extends HttpServlet { * with the "auditSubjectID()". * <P> * - * @param id string containing the signed audit log message SubjectID + * @param SubjectID string containing the signed audit log message SubjectID * @return a delimited string of groups associated * with the "auditSubjectID()" */ @@ -2167,7 +2167,7 @@ public abstract class CMSServlet extends HttpServlet { StringBuffer membersString = new StringBuffer(); while (groups.hasMoreElements()) { - IGroup group = (IGroup) groups.nextElement(); + IGroup group = groups.nextElement(); if (group.isMember(SubjectID) == true) { if (membersString.length() != 0) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/base/SystemInfoServlet.java b/pki/base/common/src/com/netscape/cms/servlet/base/SystemInfoServlet.java index 58ad4eabc..f883fd373 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/base/SystemInfoServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/base/SystemInfoServlet.java @@ -68,7 +68,6 @@ public class SystemInfoServlet extends HttpServlet { public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - boolean collect = false; String op = request.getParameter("op"); response.setContentType("text/html"); 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 5fd3cd902..95f5ae7b8 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 @@ -159,7 +159,6 @@ public class CMCRevReqServlet extends CMSServlet { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSGW_ERROR_DISPLAY_TEMPLATE")); throw new ECMSGWException(CMS.getLogMessage("CMSGW_ERROR_DISPLAY_TEMPLATE")); } - EBaseException error = null; IArgBlock header = CMS.createArgBlock(); IArgBlock ctx = CMS.createArgBlock(); 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 a2b501f14..e0978dd21 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 @@ -148,8 +148,6 @@ public class ChallengeRevocationServlet1 extends CMSServlet { throw new ECMSGWException(CMS.getLogMessage("CMSGW_ERROR_DISPLAY_TEMPLATE")); } - EBaseException error = null; - IArgBlock header = CMS.createArgBlock(); IArgBlock ctx = CMS.createArgBlock(); CMSTemplateParams argSet = new CMSTemplateParams(header, ctx); @@ -167,7 +165,6 @@ public class ChallengeRevocationServlet1 extends CMSServlet { int reasonCode = httpParams.getValueAsInt(REASON_CODE, 0); // header.addIntegerValue("reason", reasonCode); - RevocationReason reason = RevocationReason.fromInt(reasonCode); String comments = req.getParameter(IRequest.REQUESTOR_COMMENTS); Date invalidityDate = null; diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/CloneRedirect.java b/pki/base/common/src/com/netscape/cms/servlet/cert/CloneRedirect.java index 9feddbec8..d17fd959b 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/CloneRedirect.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/CloneRedirect.java @@ -104,8 +104,6 @@ public class CloneRedirect extends CMSServlet { HttpServletRequest req = cmsReq.getHttpReq(); HttpServletResponse resp = cmsReq.getHttpResp(); - EBaseException error = null; - IArgBlock header = CMS.createArgBlock(); IArgBlock fixed = CMS.createArgBlock(); CMSTemplateParams argSet = new CMSTemplateParams(header, fixed); diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/DirAuthServlet.java b/pki/base/common/src/com/netscape/cms/servlet/cert/DirAuthServlet.java index 03c909cc5..ced92ba85 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/DirAuthServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/DirAuthServlet.java @@ -198,7 +198,6 @@ public class DirAuthServlet extends CMSServlet { private void printError(CMSRequest cmsReq, String errorCode) throws EBaseException { - IArgBlock httpParams = cmsReq.getHttpParams(); HttpServletRequest httpReq = cmsReq.getHttpReq(); HttpServletResponse httpResp = cmsReq.getHttpResp(); IArgBlock header = CMS.createArgBlock(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/DisplayCRL.java b/pki/base/common/src/com/netscape/cms/servlet/cert/DisplayCRL.java index c34cd2227..f5422c2fc 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/DisplayCRL.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/DisplayCRL.java @@ -142,7 +142,6 @@ public class DisplayCRL extends CMSServlet { CMSTemplateParams argSet = new CMSTemplateParams(header, fixed); // Note error is covered in the same template as success. - EBaseException error = null; String crlIssuingPointId = req.getParameter("crlIssuingPoint"); @@ -175,8 +174,6 @@ public class DisplayCRL extends CMSServlet { HttpServletResponse resp, String crlIssuingPointId, Locale locale) { - boolean updateStatus = true; - EBaseException error = null; ICRLIssuingPoint crlIP = null; X509CRLImpl crl = null; boolean clonedCA = false; diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/DisplayHashUserEnroll.java b/pki/base/common/src/com/netscape/cms/servlet/cert/DisplayHashUserEnroll.java index bf582a82e..99082d4c5 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/DisplayHashUserEnroll.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/DisplayHashUserEnroll.java @@ -184,7 +184,6 @@ public class DisplayHashUserEnroll extends CMSServlet { private void printError(CMSRequest cmsReq, String errorCode) throws EBaseException { - IArgBlock httpParams = cmsReq.getHttpParams(); HttpServletRequest httpReq = cmsReq.getHttpReq(); HttpServletResponse httpResp = cmsReq.getHttpResp(); IArgBlock header = CMS.createArgBlock(); 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 00cca204a..853fa1e45 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 @@ -165,12 +165,12 @@ public class DoRevokeTPS extends CMSServlet { int reason = -1; boolean authorized = true; Date invalidityDate = null; - CMSTemplate form = null; Locale[] locale = new Locale[1]; CMS.debug("DoRevokeTPS before getTemplate"); try { - form = getTemplate(mFormPath, req, locale); + @SuppressWarnings("unused") + CMSTemplate form = getTemplate(mFormPath, req, locale); // check for errors } catch (IOException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSGW_ERR_GET_TEMPLATE", mFormPath, e.toString())); throw new ECMSGWException(CMS.getLogMessage("CMSGW_ERROR_DISPLAY_TEMPLATE")); 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 c48cd8635..b32ce5e11 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 @@ -932,7 +932,6 @@ public class EnrollServlet extends CMSServlet { X509CertInfo[] certInfoArray = new X509CertInfo[] { certInfo }; - X509CertInfo authCertInfo = null; String authMgr = AuditFormat.NOAUTH; // if authentication diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/GetBySerial.java b/pki/base/common/src/com/netscape/cms/servlet/cert/GetBySerial.java index fca81ff4a..b9a2221f2 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/GetBySerial.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/GetBySerial.java @@ -215,7 +215,6 @@ public class GetBySerial extends CMSServlet { X509CertImpl cert = certRecord.getCertificate(); - String browser1 = req.getParameter("browser"); if (cert != null) { // if there's a crmf request id, set that too. if (browser != null && browser.equals("ie")) { 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 1ff056ab7..4af8a6a68 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 @@ -173,7 +173,6 @@ public class HashEnrollServlet extends CMSServlet { throws EBaseException { IArgBlock httpParams = cmsReq.getHttpParams(); HttpServletRequest httpReq = cmsReq.getHttpReq(); - HttpServletResponse httpResp = cmsReq.getHttpResp(); String certType = null; String reqHost = httpReq.getRemoteHost(); @@ -231,7 +230,6 @@ public class HashEnrollServlet extends CMSServlet { private void printError(CMSRequest cmsReq, String errorCode) throws EBaseException { - IArgBlock httpParams = cmsReq.getHttpParams(); HttpServletRequest httpReq = cmsReq.getHttpReq(); HttpServletResponse httpResp = cmsReq.getHttpResp(); IArgBlock header = CMS.createArgBlock(); @@ -294,7 +292,6 @@ public class HashEnrollServlet extends CMSServlet { String certAuthEnrollOn = httpParams.getValueAsString("certauthEnroll", null); - X509CertInfo new_certInfo = null; if ((certAuthEnrollOn != null) && (certAuthEnrollOn.equals("on"))) { certAuthEnroll = true; @@ -394,7 +391,6 @@ public class HashEnrollServlet extends CMSServlet { IAuthToken authToken = mgr.getAuthToken(pageID); - X509CertInfo authCertInfo = null; String authMgr = AuditFormat.NOAUTH; if (authToken == null) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/RenewalServlet.java b/pki/base/common/src/com/netscape/cms/servlet/cert/RenewalServlet.java index fd2454210..223121577 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/RenewalServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/RenewalServlet.java @@ -418,9 +418,6 @@ public class RenewalServlet extends CMSServlet { // there's no other way to tell IArgBlock httpParams = cmsReq.getHttpParams(); - HttpServletRequest httpReq = cmsReq.getHttpReq(); - String certType = httpParams.getValueAsString(CERT_TYPE, "client"); - String agent = httpReq.getHeader("user-agent"); if (checkImportCertToNav(cmsReq.getHttpResp(), httpParams, renewed_cert)) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/UpdateDir.java b/pki/base/common/src/com/netscape/cms/servlet/cert/UpdateDir.java index 0491ccef5..707e7ff5f 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/UpdateDir.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/UpdateDir.java @@ -377,7 +377,6 @@ public class UpdateDir extends CMSServlet { } else { ICRLIssuingPoint crlIssuingPoint = mCA.getCRLIssuingPoint(crlIssuingPointId); - ICRLIssuingPointRecord crlRecord = null; updateCRLIssuingPoint(header, crlIssuingPointId, crlIssuingPoint, locale); 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 23793b3f9..99febb4cf 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 @@ -41,7 +41,6 @@ import netscape.ldap.LDAPEntry; import netscape.security.pkcs.PKCS10; import netscape.security.pkcs.PKCS10Attribute; import netscape.security.pkcs.PKCS10Attributes; -import netscape.security.util.DerOutputStream; import netscape.security.util.ObjectIdentifier; import netscape.security.x509.AVA; import netscape.security.x509.CertAttrSet; @@ -674,9 +673,6 @@ public class CRSEnrollment extends HttpServlet { responseData = responseData + "<RemoteHost>" + httpReq.getRemoteHost() + "</RemoteHost>"; - // Deal with Nonces - byte[] sn = req.getSenderNonce(); - // Deal with message type String mt = req.getMessageType(); responseData = responseData + @@ -715,7 +711,6 @@ public class CRSEnrollment extends HttpServlet { if (ext.getExtensionId().equals( OIDMap.getOID(SubjectAlternativeNameExtension.IDENT))) { - DerOutputStream dos = new DerOutputStream(); SubjectAlternativeNameExtension sane = new SubjectAlternativeNameExtension( Boolean.valueOf(false), // noncritical ext.getExtensionValue()); @@ -985,7 +980,6 @@ public class CRSEnrollment extends HttpServlet { return null; } - int count = 0; while (rids.hasMoreElements()) { RequestId rid = rids.nextElement(); if (rid == null) { @@ -1048,8 +1042,11 @@ public class CRSEnrollment extends HttpServlet { // Get Signed Data - byte[] reqAAbytes = req.getAA(); - byte[] reqAAsig = req.getAADigest(); + @SuppressWarnings("unused") + byte[] reqAAbytes = req.getAA(); // check for errors + + @SuppressWarnings("unused") + byte[] reqAAsig = req.getAADigest(); // check for errors } @@ -1155,10 +1152,7 @@ public class CRSEnrollment extends HttpServlet { private void getDetailFromRequest(CRSPKIMessage req, CRSPKIMessage crsResp) throws CRSFailureException { - IRequest issueReq = null; - X509CertImpl issuedCert = null; SubjectAlternativeNameExtension sane = null; - CertAttrSet requested_ext = null; try { PKCS10 p10 = req.getP10(); @@ -1171,7 +1165,6 @@ public class CRSEnrollment extends HttpServlet { AuthCredentials authCreds = new AuthCredentials(); - String challengePassword = null; // Here, we make a new CertInfo - it's a new start for a certificate X509CertInfo certInfo = CMS.getDefaultX509CertInfo(); @@ -1265,7 +1258,6 @@ public class CRSEnrollment extends HttpServlet { if (ext.getExtensionId().equals( OIDMap.getOID(SubjectAlternativeNameExtension.IDENT))) { - DerOutputStream dos = new DerOutputStream(); sane = new SubjectAlternativeNameExtension( new Boolean(false), // noncritical ext.getExtensionValue()); @@ -1309,7 +1301,8 @@ public class CRSEnrollment extends HttpServlet { try { if (mAppendDN != null && !mAppendDN.equals("")) { - X500Name newSubject = new X500Name(subject.toString()); + new X500Name(subject.toString()); // check for errors + subject = new X500Name(subject.toString().concat("," + mAppendDN)); } 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 b3a0f5651..85f3938b8 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 @@ -127,16 +127,15 @@ public class ExtensionsRequested implements CertAttrSet { private void construct(DerValue dv) throws IOException { DerInputStream stream = null; - DerValue[] dvs; try { // try decoding as sequence first stream = dv.toDerInputStream(); - DerValue stream_dv = stream.getDerValue(); + stream.getDerValue(); // consume stream stream.reset(); - dvs = stream.getSequence(2); + stream.getSequence(2); // consume stream } catch (IOException ioe) { // if it failed, the outer sequence may be // encapsulated in an octet string, as in the first @@ -150,7 +149,7 @@ public class ExtensionsRequested implements CertAttrSet { dv = new DerValue(octet_string); stream = dv.toDerInputStream(); - dvs = stream.getSequence(2); + stream.getSequence(2); // consume stream } // now, the stream will be in the correct format 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 aa95b622d..2edfc4f08 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 @@ -548,7 +548,6 @@ public class CMCOutputTemplate { CMS.debug("CMCOutputTemplate: Issuer names are equal"); ICertificateRepository repository = (ICertificateRepository) ca.getCertificateRepository(); - X509CertImpl impl = null; try { repository.getX509Certificate(serialno); } catch (EBaseException ee) { @@ -839,7 +838,6 @@ public class CMCOutputTemplate { return bpid; } - byte[] bv = null; String sharedSecret = null; if (tokenClass != null) { sharedSecret = tokenClass.getSharedToken(revokeSerial); diff --git a/pki/base/common/src/com/netscape/cms/servlet/connector/GenerateKeyPairServlet.java b/pki/base/common/src/com/netscape/cms/servlet/connector/GenerateKeyPairServlet.java index 171aeb64c..0a4ea589e 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/connector/GenerateKeyPairServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/connector/GenerateKeyPairServlet.java @@ -33,7 +33,6 @@ import com.netscape.certsrv.authorization.AuthzToken; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.IConfigStore; import com.netscape.certsrv.base.IPrettyPrintFormat; -import com.netscape.certsrv.common.Constants; import com.netscape.certsrv.logging.ILogger; import com.netscape.certsrv.request.IRequest; import com.netscape.certsrv.request.IRequestQueue; @@ -290,9 +289,6 @@ public class GenerateKeyPairServlet extends CMSServlet { */ public void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - String scope = req.getParameter(Constants.OP_SCOPE); - String op = req.getParameter(Constants.OP_TYPE); - super.service(req, resp); } 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 8c84f4a21..7912486f5 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 @@ -87,7 +87,8 @@ public class AdminAuthenticatePanel extends WizardPanelBase { IConfigStore cs = CMS.getConfigStore(); /* clean up if necessary */ try { - boolean done = cs.getBoolean("preop.AdminAuthenticate.done"); + @SuppressWarnings("unused") + boolean done = cs.getBoolean("preop.AdminAuthenticate.done"); // check for errors cs.putBoolean("preop.AdminAuthenticate.done", false); cs.commit(false); } catch (Exception e) { 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 223801d8f..4e73b8369 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 @@ -353,12 +353,9 @@ public class AdminPanel extends WizardPanelBase { private void createAdmin(HttpServletRequest request) throws IOException { IUGSubsystem system = (IUGSubsystem) (CMS.getSubsystem(IUGSubsystem.ID)); IConfigStore config = CMS.getConfigStore(); - String adminName = null; String groupName = null; try { - adminName = config.getString(PRE_CONF_ADMIN_NAME, - "Certificate System Administrator"); groupName = config.getString(PRE_CONF_AGENT_GROUP, "Certificate Manager Agents"); } catch (Exception e) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/AgentAuthenticatePanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/AgentAuthenticatePanel.java index 6bda87491..c1e6bffd1 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/AgentAuthenticatePanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/AgentAuthenticatePanel.java @@ -177,8 +177,11 @@ public class AgentAuthenticatePanel extends WizardPanelBase { String pwd = HttpInput.getPassword(request, "__password"); config.putString("preop.ca.agent.uid", uid); config.putString("preop.ca.agent.pwd", pwd); + + /* String host = ""; int httpsport = -1; + try { host = config.getString("preop.ca.hostname"); } catch (Exception e) { @@ -195,7 +198,6 @@ public class AgentAuthenticatePanel extends WizardPanelBase { throw new IOException("Missing port"); } - /* // Bugzilla Bug #583825 - CC: Obsolete servlets to be removed from // web.xml as part of CC interface review boolean authenticated = authenticate(host, httpsport, true, diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/BackupKeyCertPanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/BackupKeyCertPanel.java index c1529f256..d216a9212 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/BackupKeyCertPanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/BackupKeyCertPanel.java @@ -93,7 +93,8 @@ public class BackupKeyCertPanel extends WizardPanelBase { IConfigStore cs = CMS.getConfigStore(); /* clean up if necessary */ try { - boolean done = cs.getBoolean("preop.backupkeycert.done"); + @SuppressWarnings("unused") + boolean done = cs.getBoolean("preop.backupkeycert.done"); // check for errors cs.putBoolean("preop.backupkeycert.done", false); cs.commit(false); } catch (Exception e) { @@ -307,7 +308,7 @@ public class BackupKeyCertPanel extends WizardPanelBase { //String nickname = cacerts[i].getSubjectDN().toString(); String nickname = null; try { - byte[] localKeyId = addCertBag(cacerts[i], nickname, safeContents); + addCertBag(cacerts[i], nickname, safeContents); } catch (IOException e) { throw e; } catch (Exception e) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/CAInfoPanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/CAInfoPanel.java index ccaa78e0b..5da169915 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/CAInfoPanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/CAInfoPanel.java @@ -190,7 +190,6 @@ public class CAInfoPanel extends WizardPanelBase { public void validate(HttpServletRequest request, HttpServletResponse response, Context context) throws IOException { - IConfigStore config = CMS.getConfigStore(); } /** 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 43c707fbe..04ab4dac8 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 @@ -122,7 +122,8 @@ public class CertRequestPanel extends WizardPanelBase { if (cert == null) return false; try { - boolean done = cs.getBoolean("preop.CertRequestPanel.done"); + @SuppressWarnings("unused") + boolean done = cs.getBoolean("preop.CertRequestPanel.done"); // check for errors return true; } catch (Exception ee) { if (hardware) { @@ -219,7 +220,8 @@ public class CertRequestPanel extends WizardPanelBase { } try { - boolean done = cs.getBoolean("preop.CertRequestPanel.done"); + @SuppressWarnings("unused") + boolean done = cs.getBoolean("preop.CertRequestPanel.done"); // check for errors cs.putBoolean("preop.CertRequestPanel.done", false); cs.commit(false); } catch (Exception e) { @@ -487,12 +489,6 @@ public class CertRequestPanel extends WizardPanelBase { boolean hasErr = false; IConfigStore config = CMS.getConfigStore(); - String catype = ""; - try { - catype = config.getString("preop.ca.type", ""); - } catch (Exception e) { - } - if (isPanelDone()) { context.put("updateStatus", "success"); return; 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 2934b3ebe..e956edebe 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 @@ -256,7 +256,7 @@ public class CertUtil { req.setExtData("cert_request_type", reqType); if (subjectName != null) { req.setExtData("subject", subjectName); - X500Name x5Name = new X500Name(subjectName); + new X500Name(subjectName); // check for errors } } queue.updateRequest(req); @@ -596,7 +596,6 @@ public class CertUtil { StringBuffer result = new StringBuffer(); result.append("Fingerprints:\n"); - int index = 0; while (content.length() >= LINE_COUNT) { result.append(content.substring(0, LINE_COUNT)); @@ -623,9 +622,7 @@ public class CertUtil { String fullnickname = nickname; - boolean hardware = false; if (!tokenname.equals("internal") && !tokenname.equals("Internal Key Storage Token")) { - hardware = true; fullnickname = tokenname + ":" + nickname; } 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 6cafe9736..ec3c8657d 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 @@ -170,7 +170,8 @@ public class DatabasePanel extends WizardPanelBase { String secure = "false"; String cloneStartTLS = "false"; try { - String s = cs.getString("preop.database.removeData"); + @SuppressWarnings("unused") + String s = cs.getString("preop.database.removeData"); // check whether it's first time } catch (Exception e) { context.put("firsttime", "true"); } @@ -276,7 +277,8 @@ public class DatabasePanel extends WizardPanelBase { IConfigStore cs = CMS.getConfigStore(); context.put("firsttime", "false"); try { - String s = cs.getString("preop.database.removeData"); + @SuppressWarnings("unused") + String s = cs.getString("preop.database.removeData"); // check whether it's first time } catch (Exception e) { context.put("firsttime", "true"); } @@ -348,10 +350,8 @@ public class DatabasePanel extends WizardPanelBase { } if (portStr != null && portStr.length() > 0) { - int port = -1; - try { - port = Integer.parseInt(portStr); + Integer.parseInt(portStr); // check for errors } catch (Exception e) { cs.putString("preop.database.errorString", "Port is invalid"); context.put("updateStatus", "validate-failure"); @@ -872,25 +872,21 @@ public class DatabasePanel extends WizardPanelBase { IConfigStore cs = CMS.getConfigStore(); boolean hasErr = false; - boolean firsttime = false; context.put("firsttime", "false"); try { - String v = cs.getString("preop.database.removeData"); + String s = cs.getString("preop.database.removeData"); // check whether it's first time } catch (Exception e) { context.put("firsttime", "true"); - firsttime = true; } String hostname1 = ""; String portStr1 = ""; String database1 = ""; - String basedn1 = ""; try { hostname1 = cs.getString("internaldb.ldapconn.host", ""); portStr1 = cs.getString("internaldb.ldapconn.port", ""); database1 = cs.getString("internaldb.database", ""); - basedn1 = cs.getString("internaldb.basedn", ""); } catch (Exception e) { } @@ -1258,7 +1254,7 @@ public class DatabasePanel extends WizardPanelBase { attrs.add(new LDAPAttribute("objectclass", "extensibleObject")); attrs.add(new LDAPAttribute("cn", "changelog5")); attrs.add(new LDAPAttribute("nsslapd-changelogdir", dir)); - entry = new LDAPEntry("cn=changelog5,cn=config", attrs); + entry = new LDAPEntry(dn, attrs); conn.add(entry); } catch (LDAPException e) { if (e.getLDAPResultCode() == LDAPException.ENTRY_ALREADY_EXISTS) { @@ -1452,7 +1448,6 @@ public class DatabasePanel extends WizardPanelBase { String dn = "cn=" + name + "," + replicadn; String filter = "(objectclass=*)"; String[] attrs = { "nsds5replicalastinitstatus" }; - String status = null; CMS.debug("DatabasePanel replicationStatus: dn: " + dn); try { 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 ffadf5884..174af72c9 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 @@ -368,6 +368,7 @@ public class DonePanel extends WizardPanelBase { try { // Fetch the "new" security domain and display it CMS.debug("Dump contents of new Security Domain . . ."); + @SuppressWarnings("unused") String c = getDomainXML(sd_host, sd_admin_port_int, true); } catch (Exception e) { } @@ -422,6 +423,7 @@ public class DonePanel extends WizardPanelBase { // Fetch the "updated" security domain and display it CMS.debug("Dump contents of updated Security Domain . . ."); + @SuppressWarnings("unused") String c = getDomainXML(sd_host, sd_admin_port_int, true); } catch (Exception e) { context.put("errorString", "Failed to update the security domain on the domain master."); @@ -471,12 +473,8 @@ public class DonePanel extends WizardPanelBase { if (!select.equals("clone")) { if (type.equals("CA") || type.equals("KRA")) { - String beginRequestNumStr = ""; String endRequestNumStr = ""; - String beginSerialNumStr = ""; String endSerialNumStr = ""; - String requestIncStr = ""; - String serialIncStr = ""; try { endRequestNumStr = cs.getString("dbs.endRequestNumber", ""); diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetCertChain.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetCertChain.java index 6c286e818..02fbd7643 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetCertChain.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetCertChain.java @@ -71,11 +71,8 @@ public class GetCertChain extends CMSServlet { * @param cmsReq the object holding the request and response information */ protected void process(CMSRequest cmsReq) throws EBaseException { - HttpServletRequest httpReq = cmsReq.getHttpReq(); HttpServletResponse httpResp = cmsReq.getHttpResp(); - String outputString = null; - CertificateChain certChain = ((ICertAuthority) mAuthority).getCACertChain(); if (certChain == null) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetConfigEntries.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetConfigEntries.java index c9a900a0b..f1a35bac5 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetConfigEntries.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetConfigEntries.java @@ -77,7 +77,6 @@ public class GetConfigEntries extends CMSServlet { * @param cmsReq the object holding the request and response information */ protected void process(CMSRequest cmsReq) throws EBaseException { - HttpServletRequest httpReq = cmsReq.getHttpReq(); HttpServletResponse httpResp = cmsReq.getHttpResp(); IAuthToken authToken = null; diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetCookie.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetCookie.java index 2c9cc41f0..8575658ea 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetCookie.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetCookie.java @@ -233,7 +233,6 @@ public class GetCookie extends CMSServlet { } try { - String sd_url = "https://" + CMS.getEESSLHost() + ":" + CMS.getEESSLPort(); if (!url.startsWith("$")) { try { form = getTemplate(mFormPath, httpReq, locale); @@ -250,7 +249,6 @@ public class GetCookie extends CMSServlet { header.addStringValue("url", url); header.addStringValue("session_id", cookie); - EBaseException error = null; try { ServletOutputStream out = httpResp.getOutputStream(); @@ -278,7 +276,6 @@ public class GetCookie extends CMSServlet { } private String getGroupName(String uid, String subsystemname) { - String groupname = ""; IUGSubsystem subsystem = (IUGSubsystem) (CMS.getSubsystem(IUGSubsystem.ID)); if (subsystem.isMemberOf(uid, "Enterprise CA Administrators") && diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetDomainXML.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetDomainXML.java index 45c5192aa..999f13815 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetDomainXML.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetDomainXML.java @@ -23,7 +23,6 @@ import java.util.Enumeration; import java.util.Locale; import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -83,9 +82,7 @@ public class GetDomainXML extends CMSServlet { protected void process(CMSRequest cmsReq) throws EBaseException { CMS.debug("GetDomainXML: processing..."); - HttpServletRequest httpReq = cmsReq.getHttpReq(); HttpServletResponse httpResp = cmsReq.getHttpResp(); - ServletContext context = cmsReq.getServletContext(); String status = SUCCESS; String basedn = null; @@ -108,7 +105,6 @@ public class GetDomainXML extends CMSServlet { LDAPConnection conn = null; try { // get data from ldap - String[] entries = {}; String filter = "objectclass=pkiSecurityGroup"; LDAPSearchConstraints cons = null; String[] attrs = null; diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetStatus.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetStatus.java index 28279f04a..4dc6f0ff6 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetStatus.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetStatus.java @@ -63,12 +63,9 @@ public class GetStatus extends CMSServlet { * @param cmsReq the object holding the request and response information */ protected void process(CMSRequest cmsReq) throws EBaseException { - HttpServletRequest httpReq = cmsReq.getHttpReq(); HttpServletResponse httpResp = cmsReq.getHttpResp(); IConfigStore config = CMS.getConfigStore(); - String outputString = null; - String state = config.getString("cs.state", ""); String type = config.getString("cs.type", ""); diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetSubsystemCert.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetSubsystemCert.java index 7beda6620..288cfad60 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetSubsystemCert.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetSubsystemCert.java @@ -64,11 +64,8 @@ public class GetSubsystemCert extends CMSServlet { * Process the HTTP request. */ protected void process(CMSRequest cmsReq) throws EBaseException { - HttpServletRequest httpReq = cmsReq.getHttpReq(); HttpServletResponse httpResp = cmsReq.getHttpResp(); - String outputString = null; - IConfigStore cs = CMS.getConfigStore(); String nickname = ""; try { diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetTransportCert.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetTransportCert.java index ae55d2fb8..87a1788d6 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetTransportCert.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetTransportCert.java @@ -33,7 +33,6 @@ import com.netscape.certsrv.authentication.IAuthToken; import com.netscape.certsrv.authorization.AuthzToken; import com.netscape.certsrv.authorization.EAuthzAccessDenied; import com.netscape.certsrv.base.EBaseException; -import com.netscape.certsrv.base.IConfigStore; import com.netscape.certsrv.kra.IKeyRecoveryAuthority; import com.netscape.certsrv.logging.ILogger; import com.netscape.certsrv.security.ITransportKeyUnit; @@ -77,7 +76,6 @@ public class GetTransportCert extends CMSServlet { protected void process(CMSRequest cmsReq) throws EBaseException { CMS.debug("UpdateUpdater: processing..."); - HttpServletRequest httpReq = cmsReq.getHttpReq(); HttpServletResponse httpResp = cmsReq.getHttpResp(); IAuthToken authToken = null; @@ -122,8 +120,6 @@ public class GetTransportCert extends CMSServlet { return; } - IConfigStore cs = CMS.getConfigStore(); - IKeyRecoveryAuthority kra = (IKeyRecoveryAuthority) mAuthority; ITransportKeyUnit tu = kra.getTransportKeyUnit(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/ImportCAChainPanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/ImportCAChainPanel.java index a26b2dc2c..d0ccb58e9 100755 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/ImportCAChainPanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/ImportCAChainPanel.java @@ -117,7 +117,6 @@ public class ImportCAChainPanel extends WizardPanelBase { public void update(HttpServletRequest request, HttpServletResponse response, Context context) throws IOException { - IConfigStore cs = CMS.getConfigStore(); context.put("errorString", ""); context.put("title", "Import CA's Certificate Chain"); diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/MainPageServlet.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/MainPageServlet.java index 760faed4e..1d833ca9b 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/MainPageServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/MainPageServlet.java @@ -84,7 +84,6 @@ public class MainPageServlet extends CMSServlet { process(argSet, header, ctx, request, response); - EBaseException error = null; try { ServletOutputStream out = response.getOutputStream(); 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 da721b29c..f0447170e 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 @@ -17,7 +17,6 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cms.servlet.csadmin; -import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; @@ -109,7 +108,8 @@ public class NamePanel extends WizardPanelBase { public void cleanUp() throws IOException { IConfigStore cs = CMS.getConfigStore(); try { - boolean done = cs.getBoolean("preop.NamePanel.done"); + @SuppressWarnings("unused") + boolean done = cs.getBoolean("preop.NamePanel.done"); // check for errors cs.putBoolean("preop.NamePanel.done", false); cs.commit(false); } catch (Exception e) { @@ -253,7 +253,8 @@ public class NamePanel extends WizardPanelBase { } try { - boolean done = config.getBoolean("preop.NamePanel.done"); + @SuppressWarnings("unused") + boolean done = config.getBoolean("preop.NamePanel.done"); // check for errors c.setDN(dn); } catch (Exception e) { String instanceId = config.getString("service.instanceID", ""); @@ -417,7 +418,6 @@ public class NamePanel extends WizardPanelBase { if (!token.equals("Internal Key Storage Token")) { serverCertNickname = token + ":" + nickname; } - File file = new File(path + "/conf/serverCertNick.conf"); PrintStream ps = new PrintStream(new FileOutputStream(path + "/conf/serverCertNick.conf")); ps.println(serverCertNickname); ps.close(); @@ -914,10 +914,8 @@ public class NamePanel extends WizardPanelBase { httpsPortStr, "CA"); - int httpsport = -1; - try { - httpsport = Integer.parseInt(httpsPortStr); + Integer.parseInt(httpsPortStr); // check for errors } catch (Exception e) { CMS.debug( "NamePanel update: Https port is not valid. Exception: " diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/RegisterUser.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/RegisterUser.java index d1c2b6bfb..1a621d53d 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/RegisterUser.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/RegisterUser.java @@ -36,7 +36,6 @@ import com.netscape.certsrv.authentication.IAuthToken; import com.netscape.certsrv.authorization.AuthzToken; import com.netscape.certsrv.authorization.EAuthzAccessDenied; import com.netscape.certsrv.base.EBaseException; -import com.netscape.certsrv.base.IConfigStore; import com.netscape.certsrv.logging.ILogger; import com.netscape.certsrv.usrgrp.ICertUserLocator; import com.netscape.certsrv.usrgrp.IGroup; @@ -137,8 +136,6 @@ public class RegisterUser extends CMSServlet { return; } - IConfigStore cs = CMS.getConfigStore(); - // create user and add certificate String uid = httpReq.getParameter("uid"); String name = httpReq.getParameter("name"); 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 0ae550707..80a887fd2 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 @@ -122,7 +122,8 @@ public class RestoreKeyCertPanel extends WizardPanelBase { IConfigStore cs = CMS.getConfigStore(); /* clean up if necessary */ try { - boolean done = cs.getBoolean("preop.restorekeycert.done"); + @SuppressWarnings("unused") + boolean done = cs.getBoolean("preop.restorekeycert.done"); // check for errors cs.putBoolean("preop.restorekeycert.done", false); cs.commit(false); } catch (Exception e) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/SecurityDomainPanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/SecurityDomainPanel.java index 7e45f019c..f3a4169e8 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/SecurityDomainPanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/SecurityDomainPanel.java @@ -96,13 +96,11 @@ public class SecurityDomainPanel extends WizardPanelBase { String errorString = ""; String default_admin_url = ""; String name = ""; - String cstype = ""; String systemdService = ""; try { default_admin_url = config.getString("preop.securitydomain.admin_url", ""); name = config.getString("preop.securitydomain.name", ""); - cstype = config.getString("cs.type", ""); systemdService = config.getString("pkicreate.systemd.servicename", ""); } catch (Exception e) { CMS.debug(e.toString()); @@ -364,12 +362,6 @@ public class SecurityDomainPanel extends WizardPanelBase { } catch (EBaseException e) { } - String instanceRoot = ""; - try { - instanceRoot = config.getString("instanceRoot", ""); - } catch (Exception e) { - } - } else if (select.equals("existingdomain")) { config.putString("preop.securitydomain.select", "existing"); config.putString("securitydomain.select", "existing"); 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 c915d9e85..03f0e186d 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 @@ -92,7 +92,8 @@ public class SizePanel extends WizardPanelBase { IConfigStore cs = CMS.getConfigStore(); /* clean up if necessary*/ try { - boolean done = cs.getBoolean("preop.SizePanel.done"); + @SuppressWarnings("unused") + boolean done = cs.getBoolean("preop.SizePanel.done"); // check for errors cs.putBoolean("preop.SizePanel.done", false); cs.commit(false); } catch (Exception e) { @@ -132,7 +133,8 @@ public class SizePanel extends WizardPanelBase { IConfigStore config = CMS.getConfigStore(); try { - boolean done = config.getBoolean("preop.SizePanel.done"); + @SuppressWarnings("unused") + boolean done = config.getBoolean("preop.SizePanel.done"); // check whether it's first time } catch (Exception e) { context.put("firsttime", "true"); } @@ -233,9 +235,9 @@ public class SizePanel extends WizardPanelBase { } context.put("firsttime", "false"); - boolean done = false; try { - done = config.getBoolean("preop.SizePanel.done"); + @SuppressWarnings("unused") + boolean done = config.getBoolean("preop.SizePanel.done"); // check whether it's first time } catch (Exception e) { context.put("firsttime", "true"); if (select1.equals("clone")) { @@ -429,7 +431,6 @@ public class SizePanel extends WizardPanelBase { try { String keytype = config.getString(PCERT_PREFIX + ct + ".keytype"); - String keyalgorithm = config.getString(PCERT_PREFIX + ct + ".keyalgorithm"); if (keytype.equals("rsa")) { int keysize = config.getInteger( diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/UpdateDomainXML.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/UpdateDomainXML.java index 0476e26d7..a2b6ebc72 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/UpdateDomainXML.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/UpdateDomainXML.java @@ -314,8 +314,6 @@ public class UpdateDomainXML extends CMSServlet { // update in ldap LDAPEntry entry = null; - ILdapConnFactory connFactory = null; - LDAPConnection conn = null; String listName = type + "List"; String cn = host + ":"; @@ -432,13 +430,13 @@ public class UpdateDomainXML extends CMSServlet { for (int i = 0; i < len; i++) { Node nn = (Node) nodeList.item(i); - Vector v_name = parser.getValuesFromContainer(nn, "SubsystemName"); - Vector v_host = parser.getValuesFromContainer(nn, "Host"); - Vector v_adminport = parser.getValuesFromContainer(nn, "SecureAdminPort"); + Vector<String> v_name = parser.getValuesFromContainer(nn, "SubsystemName"); + Vector<String> v_host = parser.getValuesFromContainer(nn, "Host"); + Vector<String> v_adminport = parser.getValuesFromContainer(nn, "SecureAdminPort"); if ((v_name.elementAt(0).equals(name)) && (v_host.elementAt(0).equals(host)) && (v_adminport.elementAt(0).equals(adminsport))) { Node parent = nn.getParentNode(); - Node remNode = parent.removeChild(nn); + parent.removeChild(nn); count--; break; } @@ -480,7 +478,7 @@ public class UpdateDomainXML extends CMSServlet { } catch (Exception ee) { } - Node nn2 = n.removeChild(countnode); + n.removeChild(countnode); parser.addItemToContainer(n, "SubsystemCount", "" + count); // recreate domain.xml 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 a56230c2f..40190c9a7 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 @@ -1088,18 +1088,6 @@ public class WizardPanelBase implements IWizardPanel { CMS.debug("Getting domain.xml from CA..."); String c = getDomainXML(hostname, httpsadminport, true); - String list = ""; - - CMS.debug("Subsystem Type " + type); - if (type.equals("CA")) { - list = "CAList"; - } else if (type.equals("KRA")) { - list = "KRAList"; - } else if (type.equals("OCSP")) { - list = "OCSPList"; - } else if (type.equals("TKS")) { - list = "TKSList"; - } CMS.debug("Getting " + portType + " from Security Domain ..."); if (!portType.equals("UnSecurePort") && diff --git a/pki/base/common/src/com/netscape/cms/servlet/ocsp/AddCAServlet.java b/pki/base/common/src/com/netscape/cms/servlet/ocsp/AddCAServlet.java index 52efb1451..1ef680853 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/ocsp/AddCAServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/ocsp/AddCAServlet.java @@ -291,7 +291,6 @@ public class AddCAServlet extends CMSServlet { try { ServletOutputStream out = resp.getOutputStream(); - String error = null; String xmlOutput = req.getParameter("xml"); if (xmlOutput != null && xmlOutput.equals("true")) { 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 8d2c5a28b..dfe796366 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 @@ -197,7 +197,6 @@ public class CheckCertServlet extends CMSServlet { try { ServletOutputStream out = resp.getOutputStream(); - String error = null; String xmlOutput = req.getParameter("xml"); if (xmlOutput != null && xmlOutput.equals("true")) { 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 9ca7a8a18..a93512ccd 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 @@ -179,7 +179,6 @@ public class ListCAServlet extends CMSServlet { try { ServletOutputStream out = resp.getOutputStream(); - String error = null; String xmlOutput = req.getParameter("xml"); if (xmlOutput != null && xmlOutput.equals("true")) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/ocsp/RemoveCAServlet.java b/pki/base/common/src/com/netscape/cms/servlet/ocsp/RemoveCAServlet.java index ab92a7c67..4262940d0 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/ocsp/RemoveCAServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/ocsp/RemoveCAServlet.java @@ -104,8 +104,6 @@ public class RemoveCAServlet extends CMSServlet { HttpServletResponse resp = cmsReq.getHttpResp(); String auditMessage = null; String auditSubjectID = auditSubjectID(); - String auditCA = ILogger.SIGNED_AUDIT_EMPTY_VALUE; - String auditCASubjectDN = ILogger.SIGNED_AUDIT_EMPTY_VALUE; IAuthToken authToken = authenticate(cmsReq); @@ -197,7 +195,6 @@ public class RemoveCAServlet extends CMSServlet { try { ServletOutputStream out = resp.getOutputStream(); - String error = null; String xmlOutput = req.getParameter("xml"); if (xmlOutput != null && xmlOutput.equals("true")) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/processors/PKIProcessor.java b/pki/base/common/src/com/netscape/cms/servlet/processors/PKIProcessor.java index df7b0c3d1..5b78bb42a 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/processors/PKIProcessor.java +++ b/pki/base/common/src/com/netscape/cms/servlet/processors/PKIProcessor.java @@ -77,8 +77,6 @@ public class PKIProcessor implements IPKIProcessor { mServletId = servlet.getId(); - HttpServletRequest httpReq = mRequest.getHttpReq(); - } public void process(CMSRequest cmsReq) diff --git a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileReviewServlet.java b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileReviewServlet.java index 6c2733115..dd0ee7be7 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileReviewServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileReviewServlet.java @@ -236,7 +236,6 @@ public class ProfileReviewServlet extends ProfileServlet { CMS.debug("ProfileReviewServlet: profileSetId=" + profileSetId); Enumeration<String> policyIds = (profileSetId != null && profileSetId.length() > 0) ? profile.getProfilePolicyIds(profileSetId) : null; - int count = 0; ArgList list = new ArgList(); if (policyIds != null) { @@ -251,7 +250,6 @@ public class ProfileReviewServlet extends ProfileServlet { // http parameters handlePolicy(list, response, locale, id, policy, req); - count++; } } diff --git a/pki/base/common/src/com/netscape/cms/servlet/request/model/KeyRequestDAO.java b/pki/base/common/src/com/netscape/cms/servlet/request/model/KeyRequestDAO.java index 623fa941f..8a32f5d8f 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/request/model/KeyRequestDAO.java +++ b/pki/base/common/src/com/netscape/cms/servlet/request/model/KeyRequestDAO.java @@ -22,9 +22,7 @@ import java.util.ArrayList; import java.util.Hashtable; import java.util.List; -import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; import javax.ws.rs.core.UriInfo; 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 fc45395e9..c96a30a85 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 @@ -43,7 +43,6 @@ import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.IConfigStore; import com.netscape.certsrv.base.IPrettyPrintFormat; import com.netscape.certsrv.base.SessionContext; -import com.netscape.certsrv.common.Constants; import com.netscape.certsrv.logging.ILogger; import com.netscape.certsrv.tks.ITKSAuthority; import com.netscape.cms.servlet.base.CMSServlet; @@ -753,7 +752,7 @@ public class TokenServlet extends CMSServlet { private void processDiversifyKey(HttpServletRequest req, HttpServletResponse resp) throws EBaseException { - byte[] KeySetData, KeysValues, CUID, xCUID; + byte[] KeySetData, CUID, xCUID; byte[] xkeyInfo, xnewkeyInfo; boolean missingParam = false; String errorMsg = ""; @@ -825,7 +824,6 @@ public class TokenServlet extends CMSServlet { useSoftToken_s = "false"; KeySetData = null; - String outputString = null; if (!missingParam) { xCUID = com.netscape.cmsutil.util.Utils.SpecialDecode(rCUID); if (xCUID == null || xCUID.length != 10) { @@ -892,10 +890,6 @@ public class TokenServlet extends CMSServlet { + ";to newMasterKeyName=" + newSelectedToken + ":" + newKeyNickName); resp.setContentType("text/html"); - - if (KeySetData != null) { - outputString = new String(KeySetData); - } } // ! missingParam //CMS.debug("TokenServlet:processDiversifyKey " +outputString); @@ -1093,7 +1087,6 @@ public class TokenServlet extends CMSServlet { String value = ""; String status = "0"; if (encryptedData != null && encryptedData.length > 0) { - String outputString = new String(encryptedData); // sending both the pre-encrypted and encrypted data back value = "status=0&" + "data=" + com.netscape.cmsutil.util.Utils.SpecialEncode(data) + @@ -1342,9 +1335,6 @@ public class TokenServlet extends CMSServlet { */ public void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - String scope = req.getParameter(Constants.OP_SCOPE); - String op = req.getParameter(Constants.OP_TYPE); - super.service(req, resp); } } diff --git a/pki/base/common/src/com/netscape/cmscore/apps/CMSEngine.java b/pki/base/common/src/com/netscape/cmscore/apps/CMSEngine.java index 384b4cd67..5071a1c80 100644 --- a/pki/base/common/src/com/netscape/cmscore/apps/CMSEngine.java +++ b/pki/base/common/src/com/netscape/cmscore/apps/CMSEngine.java @@ -17,7 +17,6 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cmscore.apps; -import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; @@ -1563,8 +1562,6 @@ public class CMSEngine implements ICMSEngine { process.waitFor(); - BufferedReader pOut = null; - String l = null; } catch (Exception e) { } diff --git a/pki/base/common/src/com/netscape/cmscore/apps/Upgrade.java b/pki/base/common/src/com/netscape/cmscore/apps/Upgrade.java index b5307c448..326e9b5e6 100644 --- a/pki/base/common/src/com/netscape/cmscore/apps/Upgrade.java +++ b/pki/base/common/src/com/netscape/cmscore/apps/Upgrade.java @@ -162,7 +162,6 @@ public final class Upgrade { throws EBaseException { boolean isCA = false; boolean isRA = false; - boolean isKRA = false; // determine what subsystems do we have? IConfigStore cs = c.getSubStore("ca"); @@ -174,10 +173,6 @@ public final class Upgrade { if (cs != null && cs.size() > 0) { isRA = true; } - cs = c.getSubStore("kra"); - if (cs != null && cs.size() > 0) { - isKRA = true; - } Setup.installAuthImpls(c); Setup.installOIDMap(c); diff --git a/pki/base/common/src/com/netscape/cmscore/authentication/SSLClientCertAuthentication.java b/pki/base/common/src/com/netscape/cmscore/authentication/SSLClientCertAuthentication.java index 19438037b..3f0d7a87b 100644 --- a/pki/base/common/src/com/netscape/cmscore/authentication/SSLClientCertAuthentication.java +++ b/pki/base/common/src/com/netscape/cmscore/authentication/SSLClientCertAuthentication.java @@ -129,7 +129,6 @@ public class SSLClientCertAuthentication implements IAuthManager { } String clientCertIssuerDN = clientCert.getIssuerDN().toString(); - BigInteger[] bigIntArray = null; if (mCertDB != null) { /* is CA */ ICertRecord record = null; diff --git a/pki/base/common/src/com/netscape/cmscore/base/PropConfigStore.java b/pki/base/common/src/com/netscape/cmscore/base/PropConfigStore.java index 1cc0330c7..482bcc7b9 100644 --- a/pki/base/common/src/com/netscape/cmscore/base/PropConfigStore.java +++ b/pki/base/common/src/com/netscape/cmscore/base/PropConfigStore.java @@ -251,7 +251,7 @@ public class PropConfigStore implements IConfigStore, Cloneable { * @exception EBaseException failed to retrieve value */ public String getString(String name) throws EBaseException { - String str = (String) get(name); + String str = get(name); if (str == null) { CMS.traceHashKey(mDebugType, getFullName(name), "<notpresent>"); @@ -629,7 +629,7 @@ public class PropConfigStore implements IConfigStore, Cloneable { */ public IConfigStore getSubStore(String name) { String fullname = getFullName(name); - String reference = (String) mSource.get(fullname); + String reference = mSource.get(fullname); if (reference == null) { PropConfigStore ps = new PropConfigStore(fullname, mSource); diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/CertificateRepository.java b/pki/base/common/src/com/netscape/cmscore/dbs/CertificateRepository.java index 6ae379840..0d004d335 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/CertificateRepository.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/CertificateRepository.java @@ -38,12 +38,10 @@ import netscape.security.x509.X509CertInfo; import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.base.EBaseException; -import com.netscape.certsrv.base.IConfigStore; import com.netscape.certsrv.base.MetaInfo; import com.netscape.certsrv.base.SessionContext; import com.netscape.certsrv.ca.ICRLIssuingPoint; import com.netscape.certsrv.dbs.EDBException; -import com.netscape.certsrv.dbs.IDBRegistry; import com.netscape.certsrv.dbs.IDBSSession; import com.netscape.certsrv.dbs.IDBSearchResults; import com.netscape.certsrv.dbs.IDBSubsystem; @@ -90,13 +88,7 @@ public class CertificateRepository extends Repository throws EDBException { super(dbService, increment, baseDN); mBaseDN = certRepoBaseDN; - mDBService = dbService; - - // registers CMS database attributes - IDBRegistry reg = dbService.getRegistry(); - - IConfigStore cfg = mDBService.getConfigStore(); } public ICertRecord createCertRecord(BigInteger id, Certificate cert, MetaInfo meta) { diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/DBVirtualList.java b/pki/base/common/src/com/netscape/cmscore/dbs/DBVirtualList.java index 934cf1ea0..574ab41c0 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/DBVirtualList.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/DBVirtualList.java @@ -640,8 +640,6 @@ public class DBVirtualList<E> implements IDBVirtualList<E> { * the caller should really check the index is within bound before this * but I'll take care of this just in case they are too irresponsible */ - int baseJumpTo = 0; - if (!mInitialized) mSize = getSize(); diff --git a/pki/base/common/src/com/netscape/cmscore/extensions/KeyUsage.java b/pki/base/common/src/com/netscape/cmscore/extensions/KeyUsage.java index bba95949d..dc4423357 100644 --- a/pki/base/common/src/com/netscape/cmscore/extensions/KeyUsage.java +++ b/pki/base/common/src/com/netscape/cmscore/extensions/KeyUsage.java @@ -19,7 +19,6 @@ package com.netscape.cmscore.extensions; import java.io.IOException; -import netscape.security.util.DerOutputStream; import netscape.security.util.ObjectIdentifier; import netscape.security.x509.Extension; import netscape.security.x509.KeyUsageExtension; @@ -196,7 +195,6 @@ public class KeyUsage implements ICMSExtension { ext = (KeyUsageExtension) extension; } else { try { - DerOutputStream der = new DerOutputStream(); byte[] value = extension.getExtensionValue(); ext = new KeyUsageExtension(new Boolean(true), value); diff --git a/pki/base/common/src/com/netscape/cmscore/jobs/JobsScheduler.java b/pki/base/common/src/com/netscape/cmscore/jobs/JobsScheduler.java index 654f3e494..79225a13f 100644 --- a/pki/base/common/src/com/netscape/cmscore/jobs/JobsScheduler.java +++ b/pki/base/common/src/com/netscape/cmscore/jobs/JobsScheduler.java @@ -156,21 +156,19 @@ public class JobsScheduler implements Runnable, IJobsScheduler { // register the job mJobs.put(jobName, job); - } catch (ClassNotFoundException e) { - String errMsg = "JobsScheduler:: init()-" + e.toString(); + } catch (ClassNotFoundException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_JOBS_INIT_ERROR", e.toString())); throw new EJobsException(CMS.getUserMessage("CMS_JOB_LOAD_CLASS_FAILED", classPath)); - } catch (IllegalAccessException e) { - String errMsg = "JobsScheduler:: init()-" + e.toString(); + } catch (IllegalAccessException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_JOBS_INIT_ERROR", e.toString())); throw new EJobsException(CMS.getUserMessage("CMS_JOB_LOAD_CLASS_FAILED", classPath)); - } catch (InstantiationException e) { - String errMsg = "JobsScheduler: init()-" + e.toString(); + } catch (InstantiationException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_JOBS_INIT_ERROR", e.toString())); throw new EJobsException(CMS.getUserMessage("CMS_JOB_LOAD_CLASS_FAILED", classPath)); + } catch (EBaseException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_JOBS_INIT_ERROR", e.toString())); throw e; @@ -237,7 +235,7 @@ public class JobsScheduler implements Runnable, IJobsScheduler { try { Thread.sleep(duration); } catch (InterruptedException e) { - System.out.println(e.toString()); + System.out.println(e); } } // if (duration == 0), it's time @@ -494,19 +492,19 @@ public class JobsScheduler implements Runnable, IJobsScheduler { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_JOBS_CREATE_NEW", e.toString())); if (Debug.ON) - Debug.trace("class NOT instantiated: " + e.toString()); + Debug.trace("class NOT instantiated: " + e); throw new EJobsException(CMS.getUserMessage("CMS_JOB_LOAD_CLASS_FAILED", className)); } catch (ClassNotFoundException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_JOBS_CREATE_NEW", e.toString())); if (Debug.ON) - Debug.trace("class NOT instantiated: " + e.toString()); + Debug.trace("class NOT instantiated: " + e); throw new EJobsException(CMS.getUserMessage("CMS_JOB_LOAD_CLASS_FAILED", className)); } catch (IllegalAccessException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_JOBS_CREATE_NEW", e.toString())); if (Debug.ON) - Debug.trace("class NOT instantiated: " + e.toString()); + Debug.trace("class NOT instantiated: " + e); throw new EJobsException(CMS.getUserMessage("CMS_JOB_LOAD_CLASS_FAILED", className)); } } diff --git a/pki/base/common/src/com/netscape/cmscore/ldap/PublisherProcessor.java b/pki/base/common/src/com/netscape/cmscore/ldap/PublisherProcessor.java index a0bc2d145..147eee07e 100644 --- a/pki/base/common/src/com/netscape/cmscore/ldap/PublisherProcessor.java +++ b/pki/base/common/src/com/netscape/cmscore/ldap/PublisherProcessor.java @@ -154,20 +154,17 @@ public class PublisherProcessor implements isEnable = true; } catch (ClassNotFoundException e) { - String errMsg = "PublisherProcessor:: init()-" + e.toString(); - log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_LDAP_PUBLISHER_INIT_FAILED", e.toString())); throw new ELdapException(CMS.getUserMessage("CMS_LDAP_FAIL_LOAD_CLASS", className)); - } catch (IllegalAccessException e) { - String errMsg = "PublisherProcessor:: init()-" + e.toString(); + } catch (IllegalAccessException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_LDAP_PUBLISHER_INIT_FAILED", e.toString())); throw new ELdapException(CMS.getUserMessage("CMS_LDAP_FAIL_LOAD_CLASS", className)); - } catch (InstantiationException e) { - String errMsg = "PublisherProcessor: init()-" + e.toString(); + } catch (InstantiationException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_LDAP_PUBLISHER_INIT_FAILED", e.toString())); throw new ELdapException(CMS.getUserMessage("CMS_LDAP_FAIL_LOAD_CLASS", className)); + } catch (Throwable e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_LDAP_SKIP_PUBLISHER", insName, e.toString())); // Let the server continue if it is a @@ -241,20 +238,17 @@ public class PublisherProcessor implements mapperInst.init(mConfig); isEnable = true; } catch (ClassNotFoundException e) { - String errMsg = "PublisherProcessor:: init()-" + e.toString(); - log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_LDAP_PUBLISHER_INIT_FAILED", e.toString())); throw new ELdapException(CMS.getUserMessage("CMS_LDAP_FAIL_LOAD_CLASS", className)); - } catch (IllegalAccessException e) { - String errMsg = "PublisherProcessor:: init()-" + e.toString(); + } catch (IllegalAccessException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_LDAP_PUBLISHER_INIT_FAILED", e.toString())); throw new ELdapException(CMS.getUserMessage("CMS_LDAP_FAIL_LOAD_CLASS", className)); - } catch (InstantiationException e) { - String errMsg = "PublisherProcessor: init()-" + e.toString(); + } catch (InstantiationException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_LDAP_PUBLISHER_INIT_FAILED", e.toString())); throw new ELdapException(CMS.getUserMessage("CMS_LDAP_FAIL_LOAD_CLASS", className)); + } catch (Throwable e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_LDAP_SKIP_MAPPER", insName, e.toString())); // Let the server continue if it is a @@ -331,20 +325,17 @@ public class PublisherProcessor implements log(ILogger.LL_INFO, "rule instance " + insName + " added"); } catch (ClassNotFoundException e) { - String errMsg = "PublisherProcessor:: init()-" + e.toString(); - log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_LDAP_PUBLISHER_INIT_FAILED", e.toString())); throw new ELdapException(CMS.getUserMessage("CMS_LDAP_FAIL_LOAD_CLASS", className)); - } catch (IllegalAccessException e) { - String errMsg = "PublisherProcessor:: init()-" + e.toString(); + } catch (IllegalAccessException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_LDAP_PUBLISHER_INIT_FAILED", e.toString())); throw new ELdapException(CMS.getUserMessage("CMS_LDAP_FAIL_LOAD_CLASS", className)); - } catch (InstantiationException e) { - String errMsg = "PublisherProcessor: init()-" + e.toString(); + } catch (InstantiationException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_LDAP_PUBLISHER_INIT_FAILED", e.toString())); throw new ELdapException(CMS.getUserMessage("CMS_LDAP_FAIL_LOAD_CLASS", className)); + } catch (Throwable e) { if (mConfig == null) { throw new ELdapException(CMS.getUserMessage("CMS_LDAP_FAIL_LOAD_CLASS", className)); @@ -612,7 +603,7 @@ public class PublisherProcessor implements public Vector<String> getMapperInstanceParams(String insName) throws ELdapException { ILdapMapper mapperInst = null; - MapperProxy proxy = (MapperProxy) mMapperInsts.get(insName); + MapperProxy proxy = mMapperInsts.get(insName); if (proxy == null) { return null; @@ -629,8 +620,7 @@ public class PublisherProcessor implements public Vector<String> getPublisherDefaultParams(String implName) throws ELdapException { // is this a registered implname? - PublisherPlugin plugin = (PublisherPlugin) - mPublisherPlugins.get(implName); + PublisherPlugin plugin = mPublisherPlugins.get(implName); if (plugin == null) { log(ILogger.LL_FAILURE, @@ -841,7 +831,7 @@ public class PublisherProcessor implements "Cannot mark cert 0x" + serialNo.toString(16) + " published as " + published + " in the ldap directory. Cert Record not found. Error: " - + e.toString() + + e + " Don't be alarmed if it's a subordinate ca or clone's ca siging cert. " + "Otherwise your internal db may be corrupted."); } @@ -903,10 +893,10 @@ public class PublisherProcessor implements } catch (Exception e) { // continue publishing even publisher has errors //log(ILogger.LL_WARN, e.toString()); - CMS.debug("PublisherProcessor::publishCACert returned error: " + e.toString()); + CMS.debug("PublisherProcessor::publishCACert returned error: " + e); error = true; errorRule = errorRule + " " + rule.getInstanceName() + - " error:" + e.toString(); + " error:" + e; } } // set the ldap published flag. @@ -989,7 +979,6 @@ public class PublisherProcessor implements */ public void publishXCertPair(byte[] pair) throws ELdapException { - boolean error = false; String errorRule = ""; if (!enabled()) @@ -1036,11 +1025,10 @@ public class PublisherProcessor implements } catch (Exception e) { // continue publishing even publisher has errors //log(ILogger.LL_WARN, e.toString()); - error = true; errorRule = errorRule + " " + rule.getInstanceName() + - " error:" + e.toString(); + " error:" + e; - CMS.debug("PublisherProcessor::publishXCertPair: error: " + e.toString()); + CMS.debug("PublisherProcessor::publishXCertPair: error: " + e); } } } @@ -1248,7 +1236,7 @@ public class PublisherProcessor implements error = true; errorRule = errorRule + " " + rule.getInstanceName(); - CMS.debug("PublisherProcessor::publishCRL: error: " + e.toString()); + CMS.debug("PublisherProcessor::publishCRL: error: " + e); } } } catch (ELdapException e) { @@ -1306,15 +1294,15 @@ public class PublisherProcessor implements } } catch (Exception e) { CMS.debug( - "Error publishing CRL to " + dn + ": " + e.toString()); + "Error publishing CRL to " + dn + ": " + e); error = true; errorRule = errorRule + " " + rule.getInstanceName(); - CMS.debug("PublisherProcessor::publishCRL: error: " + e.toString()); + CMS.debug("PublisherProcessor::publishCRL: error: " + e); } } } catch (ELdapException e) { CMS.debug( - "Error publishing CRL to " + dn + ": " + e.toString()); + "Error publishing CRL to " + dn + ": " + e); throw e; } finally { if (conn != null) { diff --git a/pki/base/common/src/com/netscape/cmscore/ldapconn/LdapAnonConnFactory.java b/pki/base/common/src/com/netscape/cmscore/ldapconn/LdapAnonConnFactory.java index f7a772232..dc4c86547 100644 --- a/pki/base/common/src/com/netscape/cmscore/ldapconn/LdapAnonConnFactory.java +++ b/pki/base/common/src/com/netscape/cmscore/ldapconn/LdapAnonConnFactory.java @@ -344,10 +344,6 @@ public class LdapAnonConnFactory implements ILdapConnFactory { if (anon.getFacId() != mConns) { // returning a connection not from this factory. log(ILogger.LL_WARN, "returnConn: unknown connection."); - - /* swallow this error but see who's doing it. */ - ELdapException e = - new ELdapException(CMS.getUserMessage("CMS_LDAP_UNKNOWN_RETURNED_CONN")); } // check if conn has already been returned. for (int i = 0; i < mNumConns; i++) { @@ -357,8 +353,6 @@ public class LdapAnonConnFactory implements ILdapConnFactory { /* swallow this error but see who's doing it. */ log(ILogger.LL_WARN, "returnConn: previously returned connection."); - ELdapException e = - new ELdapException(CMS.getUserMessage("CMS_LDAP_BAD_RETURNED_CONN")); } } diff --git a/pki/base/common/src/com/netscape/cmscore/ldapconn/LdapBoundConnFactory.java b/pki/base/common/src/com/netscape/cmscore/ldapconn/LdapBoundConnFactory.java index 64f22d302..b4839f7d5 100644 --- a/pki/base/common/src/com/netscape/cmscore/ldapconn/LdapBoundConnFactory.java +++ b/pki/base/common/src/com/netscape/cmscore/ldapconn/LdapBoundConnFactory.java @@ -417,19 +417,11 @@ public class LdapBoundConnFactory implements ILdapBoundConnFactory { if (boundconn.getFacId() != mConns) { log(ILogger.LL_WARN, "returnConn: unknown connection."); - - /* swallow this exception but see who's doing it. */ - ELdapException e = - new ELdapException(CMS.getUserMessage("CMS_LDAP_UNKNOWN_RETURNED_CONN")); } for (int i = 0; i < mNumConns; i++) { if (mConns[i] == conn) { CMS.debug( "returnConn: previously returned connection."); - - /* swallow this exception but see who's doing it */ - ELdapException e = - new ELdapException(CMS.getUserMessage("CMS_LDAP_BAD_RETURNED_CONN")); } } mConns[mNumConns++] = boundconn; diff --git a/pki/base/common/src/com/netscape/cmscore/logging/LogSubsystem.java b/pki/base/common/src/com/netscape/cmscore/logging/LogSubsystem.java index 8ac304f8c..1cfce4e65 100644 --- a/pki/base/common/src/com/netscape/cmscore/logging/LogSubsystem.java +++ b/pki/base/common/src/com/netscape/cmscore/logging/LogSubsystem.java @@ -126,17 +126,14 @@ public class LogSubsystem implements ILogSubsystem { // for view from console } catch (ClassNotFoundException e) { - String errMsg = "LogSubsystem:: init()-" + e.toString(); - throw new EBaseException(insName + ":Failed to instantiate class " + className); - } catch (IllegalAccessException e) { - String errMsg = "LogSubsystem:: init()-" + e.toString(); + } catch (IllegalAccessException e) { throw new EBaseException(insName + ":Failed to instantiate class " + className); - } catch (InstantiationException e) { - String errMsg = "LogSubsystem:: init()-" + e.toString(); + } catch (InstantiationException e) { throw new EBaseException(insName + ":Failed to instantiate class " + className); + } catch (Throwable e) { e.printStackTrace(); throw new EBaseException(insName diff --git a/pki/base/common/src/com/netscape/cmscore/notification/EmailTemplate.java b/pki/base/common/src/com/netscape/cmscore/notification/EmailTemplate.java index 0a1a05f6e..bdc16a24e 100644 --- a/pki/base/common/src/com/netscape/cmscore/notification/EmailTemplate.java +++ b/pki/base/common/src/com/netscape/cmscore/notification/EmailTemplate.java @@ -78,9 +78,7 @@ public class EmailTemplate implements IEmailTemplate { /* check if file exists and is accessible */ if ((!template.exists()) || (!template.canRead()) || (template.isDirectory())) { - String error = "Template: " + mTemplateFile + " does not exist or invalid"; - - log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_NOTIFY_TEMPLATE_NOT_EXIST")); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_NOTIFY_TEMPLATE_NOT_EXIST", mTemplateFile)); return false; } @@ -90,9 +88,7 @@ public class EmailTemplate implements IEmailTemplate { try { input = new FileReader(template); } catch (FileNotFoundException e) { - String error = "Template: " + mTemplateFile + " not found"; - - log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_NOTIFY_TEMPLATE_NOT_FOUND")); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_NOTIFY_TEMPLATE_NOT_FOUND", mTemplateFile)); return false; } @@ -100,8 +96,6 @@ public class EmailTemplate implements IEmailTemplate { /* load template */ mFileContents = loadFile(input); if (mFileContents == null) { - String error = "Template: Error loading file into string"; - log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_NOTIFY_TEMPLATE_LOAD_ERROR")); return false; } @@ -159,8 +153,6 @@ public class EmailTemplate implements IEmailTemplate { buf.append("\n"); } } catch (IOException e) { - String error = "Template: Error loading file"; - log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_NOTIFY_TEMPLATE_LOADING")); return null; } diff --git a/pki/base/common/src/com/netscape/cmscore/policy/PolicySet.java b/pki/base/common/src/com/netscape/cmscore/policy/PolicySet.java index 37780cfc2..bd38138ff 100644 --- a/pki/base/common/src/com/netscape/cmscore/policy/PolicySet.java +++ b/pki/base/common/src/com/netscape/cmscore/policy/PolicySet.java @@ -152,9 +152,8 @@ public class PolicySet implements IPolicySet { */ public PolicyResult apply(IRequest req) { // If there are no rules, we are done. - int cnt; - if ((cnt = mRules.size()) == 0) + if (mRules.size() == 0) return PolicyResult.ACCEPTED; // All policies are applied before returning the result. Hence diff --git a/pki/base/common/src/com/netscape/cmscore/profile/ProfileSubsystem.java b/pki/base/common/src/com/netscape/cmscore/profile/ProfileSubsystem.java index b5f829f77..2435fa462 100644 --- a/pki/base/common/src/com/netscape/cmscore/profile/ProfileSubsystem.java +++ b/pki/base/common/src/com/netscape/cmscore/profile/ProfileSubsystem.java @@ -251,7 +251,7 @@ public class ProfileSubsystem implements IProfileSubsystem { public String getProfileEnableBy(String id) { if (!isProfileEnable(id)) return null; - IProfile profile = (IProfile) mProfiles.get(id); + IProfile profile = mProfiles.get(id); String enableBy = null; try { @@ -295,11 +295,11 @@ public class ProfileSubsystem implements IProfileSubsystem { */ public IProfile getProfile(String id) throws EProfileException { - return (IProfile) mProfiles.get(id); + return mProfiles.get(id); } public String getProfileClassId(String id) { - return (String) mProfileClassIds.get(id); + return mProfileClassIds.get(id); } /** diff --git a/pki/base/common/src/com/netscape/cmscore/security/CertificateInfo.java b/pki/base/common/src/com/netscape/cmscore/security/CertificateInfo.java index 3eeb39e0c..fc7fb9087 100644 --- a/pki/base/common/src/com/netscape/cmscore/security/CertificateInfo.java +++ b/pki/base/common/src/com/netscape/cmscore/security/CertificateInfo.java @@ -226,7 +226,6 @@ public abstract class CertificateInfo { //KeyCertUtil.setOCSPSigning(mKeyPair, exts, mProperties); KeyCertUtil.setAuthInfoAccess(mKeyPair, exts, mProperties); KeyCertUtil.setOCSPNoCheck(mKeyPair, exts, mProperties); - KeyPair caKeyPair = (KeyPair) mProperties.get(Constants.PR_CA_KEYPAIR); String aki = mProperties.getAKI(); if ((aki != null) && (aki.equals(Constants.TRUE))) { diff --git a/pki/base/common/src/com/netscape/cmscore/security/JssSubsystem.java b/pki/base/common/src/com/netscape/cmscore/security/JssSubsystem.java index b6aaa02cc..8bcc74de5 100644 --- a/pki/base/common/src/com/netscape/cmscore/security/JssSubsystem.java +++ b/pki/base/common/src/com/netscape/cmscore/security/JssSubsystem.java @@ -852,7 +852,7 @@ public final class JssSubsystem implements ICryptoSubsystem { public void isX500DN(String dn) throws EBaseException { try { - X500Name name = new X500Name(dn); + new X500Name(dn); // check for errors } catch (IOException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_SECURITY_X500_NAME", e.toString())); throw new EBaseException(CMS.getUserMessage("CMS_BASE_INVALID_X500_NAME", dn)); @@ -944,7 +944,6 @@ public final class JssSubsystem implements ICryptoSubsystem { public KeyPair getECCKeyPair(KeyCertData properties) throws EBaseException { String token = Constants.PR_INTERNAL_TOKEN_NAME; - String keyType = "ECC"; String keyCurve = "nistp512"; String certType = null; KeyPair pair = null; @@ -1067,7 +1066,6 @@ public final class JssSubsystem implements ICryptoSubsystem { X509Certificate cert = getCertificate(nickname, serialno, issuername); if (cert instanceof TokenCertificate) { TokenCertificate tcert = (TokenCertificate) cert; - CryptoStore store = tcert.getOwningToken().getCryptoStore(); CMS.debug("*** deleting this token cert"); tcert.getOwningToken().getCryptoStore().deleteCert(tcert); @@ -1120,7 +1118,6 @@ public final class JssSubsystem implements ICryptoSubsystem { CMS.debug("*** removing root cert"); if (cert instanceof TokenCertificate) { TokenCertificate tcert = (TokenCertificate) cert; - CryptoStore store = tcert.getOwningToken().getCryptoStore(); CMS.debug("*** deleting this token cert"); tcert.getOwningToken().getCryptoStore().deleteCert(tcert); @@ -1175,8 +1172,9 @@ public final class JssSubsystem implements ICryptoSubsystem { for (int i = 0; i < list.length; i++) { try { + @SuppressWarnings("unused") PrivateKey key = - CryptoManager.getInstance().findPrivKeyByCert(list[i]); + CryptoManager.getInstance().findPrivKeyByCert(list[i]); // check for errors Debug.trace("JssSubsystem getRootCerts: find private key " + list[i].getNickname()); } catch (ObjectNotFoundException e) { @@ -1247,8 +1245,9 @@ public final class JssSubsystem implements ICryptoSubsystem { for (int i = 0; i < list.length; i++) { try { + @SuppressWarnings("unused") PrivateKey key = - CryptoManager.getInstance().findPrivKeyByCert(list[i]); + CryptoManager.getInstance().findPrivKeyByCert(list[i]); // check for errors String nickname = list[i].getNickname(); if (tokenName.equals(Constants.PR_INTERNAL_TOKEN_NAME) || tokenName.equals(Constants.PR_FULL_INTERNAL_TOKEN_NAME)) { @@ -1307,7 +1306,6 @@ public final class JssSubsystem implements ICryptoSubsystem { while (enums.hasMoreElements()) { CryptoToken token = (CryptoToken) enums.nextElement(); - String tokenName = token.getName(); CryptoStore store = token.getCryptoStore(); X509Certificate[] list = store.getCertificates(); @@ -1538,7 +1536,6 @@ public final class JssSubsystem implements ICryptoSubsystem { if (notAfter.equals(qualifier)) { if (cert instanceof TokenCertificate) { TokenCertificate tcert = (TokenCertificate) cert; - CryptoStore store = tcert.getOwningToken().getCryptoStore(); tcert.getOwningToken().getCryptoStore().deleteCert(tcert); } else { @@ -1620,7 +1617,6 @@ public final class JssSubsystem implements ICryptoSubsystem { if (notAfter.equals(qualifier)) { if (cert instanceof TokenCertificate) { TokenCertificate tcert = (TokenCertificate) cert; - CryptoStore store = tcert.getOwningToken().getCryptoStore(); tcert.getOwningToken().getCryptoStore().deleteCert(tcert); } else { @@ -1660,7 +1656,6 @@ public final class JssSubsystem implements ICryptoSubsystem { public void deleteTokenCertificate(String nickname, String pathname) throws EBaseException { try { X509Certificate cert = CryptoManager.getInstance().findCertByNickname(nickname); - String issuerName = cert.getSubjectDN().getName(); Principal principal = cert.getSubjectDN(); DN dn = new DN(principal.getName()); BigInteger serialno = cert.getSerialNumber(); @@ -1674,7 +1669,6 @@ public final class JssSubsystem implements ICryptoSubsystem { stream.close(); if (cert instanceof TokenCertificate) { TokenCertificate tcert = (TokenCertificate) cert; - CryptoStore store = tcert.getOwningToken().getCryptoStore(); tcert.getOwningToken().getCryptoStore().deleteCert(tcert); } else diff --git a/pki/base/common/src/com/netscape/cmscore/security/KeyCertUtil.java b/pki/base/common/src/com/netscape/cmscore/security/KeyCertUtil.java index 1d03911b4..3eef57718 100644 --- a/pki/base/common/src/com/netscape/cmscore/security/KeyCertUtil.java +++ b/pki/base/common/src/com/netscape/cmscore/security/KeyCertUtil.java @@ -141,11 +141,11 @@ public class KeyCertUtil { DerValue b_der = new DerValue(b); while (b_der.data.available() != 0) { - Extension de = new Extension(b_der.data.getDerValue()); + new Extension(b_der.data.getDerValue()); // check for errors } } catch (IOException e) { try { - Extension de = new Extension(new DerValue(b)); + new Extension(new DerValue(b)); // check for errors } catch (IOException ex) { throw new EBaseException(CMS.getUserMessage("CMS_BASE_INVALID_CERT_EXTENSION")); } diff --git a/pki/base/common/src/com/netscape/cmscore/security/PWUtil.java b/pki/base/common/src/com/netscape/cmscore/security/PWUtil.java index 524e7a504..3938bf5d2 100644 --- a/pki/base/common/src/com/netscape/cmscore/security/PWUtil.java +++ b/pki/base/common/src/com/netscape/cmscore/security/PWUtil.java @@ -17,9 +17,6 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cmscore.security; -import java.io.BufferedReader; -import java.io.InputStreamReader; - import org.mozilla.jss.util.Password; import org.mozilla.jss.util.PasswordCallback; @@ -27,9 +24,6 @@ public class PWUtil { public static Password readPasswordFromStream() throws PasswordCallback.GiveUpException { - BufferedReader in; - - in = new BufferedReader(new InputStreamReader(System.in)); StringBuffer buf = new StringBuffer(); String passwordString = new String(); diff --git a/pki/base/common/src/com/netscape/cmscore/usrgrp/UGSubsystem.java b/pki/base/common/src/com/netscape/cmscore/usrgrp/UGSubsystem.java index bf5606196..1bf251865 100644 --- a/pki/base/common/src/com/netscape/cmscore/usrgrp/UGSubsystem.java +++ b/pki/base/common/src/com/netscape/cmscore/usrgrp/UGSubsystem.java @@ -133,7 +133,6 @@ public final class UGSubsystem implements IUGSubsystem { mLdapConnFactory = new LdapBoundConnFactory(); mLdapConnFactory.init(ldapConfig); - IConfigStore c = config.getSubStore(PROP_IMPL); } catch (EBaseException e) { if (CMS.isPreOpMode()) return; @@ -250,16 +249,8 @@ public final class UGSubsystem implements IUGSubsystem { return (User) e.nextElement(); } catch (LDAPException e) { - String errMsg = "findUser()" + e.toString(); - - if (e.getLDAPResultCode() == LDAPException.UNAVAILABLE) { - errMsg = "findUser: " + "Internal DB is unavailable"; - } log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_FIND_USER", e.toString())); } catch (ELdapException e) { - String errMsg = - "find User: Could not get connection to internaldb. Error " + e; - log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_INTERNAL_DB", e.toString())); } finally { if (ldapconn != null) @@ -307,19 +298,10 @@ public final class UGSubsystem implements IUGSubsystem { Enumeration<IUser> e = buildUsers(res); - return (User) e.nextElement(); + return e.nextElement(); } catch (LDAPException e) { - String errMsg = "findUsersByCert()" + e.toString(); - - if (e.getLDAPResultCode() == LDAPException.UNAVAILABLE) { - errMsg = "findUsersByCert: " + "Internal DB is unavailable"; - } log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_FIND_USER_BY_CERT", e.toString())); } catch (ELdapException e) { - String errMsg = - "find Users By Cert: " + - "Could not get connection to internaldb. Error " + e; - log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_FIND_USER_BY_CERT", e.toString())); } finally { if (ldapconn != null) @@ -349,16 +331,8 @@ public final class UGSubsystem implements IUGSubsystem { return e; } catch (LDAPException e) { - String errMsg = "findUsers()" + e.toString(); - - if (e.getLDAPResultCode() == LDAPException.UNAVAILABLE) { - errMsg = "findUsersByCert: " + "Internal DB is unavailable"; - } log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_FIND_USERS", e.toString())); } catch (ELdapException e) { - String errMsg = - "find Users: Could not get connection to internaldb. Error " + e; - log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_FIND_USERS", e.toString())); } finally { if (ldapconn != null) @@ -395,11 +369,6 @@ public final class UGSubsystem implements IUGSubsystem { return e; } catch (LDAPException e) { - String errMsg = "listUsers()" + e.toString(); - - if (e.getLDAPResultCode() == LDAPException.UNAVAILABLE) { - errMsg = "findUsersByCert: " + "Internal DB is unavailable"; - } log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_LIST_USERS", e.toString())); } catch (Exception e) { throw new EUsrGrpException(CMS.getUserMessage("CMS_INTERNAL_ERROR")); @@ -526,10 +495,7 @@ public final class UGSubsystem implements IUGSubsystem { if (userdn != null) { id.setUserDN(userdn); } else { // the impossible - String errMsg = "buildUser(): user DN not found: " + - userdn; - - log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_BUILD_USER")); + log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_BUILD_USER", userdn)); throw new EUsrGrpException(CMS.getUserMessage("CMS_INTERNAL_ERROR")); } @@ -738,9 +704,6 @@ public final class UGSubsystem implements IUGSubsystem { ldapconn = getConn(); ldapconn.add(entry); } catch (ELdapException e) { - String errMsg = - "add User: Could not get connection to internaldb. Error " + e; - log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_ADD_USER", e.toString())); } finally { if (ldapconn != null) @@ -807,18 +770,9 @@ public final class UGSubsystem implements IUGSubsystem { if (Debug.ON) { e.printStackTrace(); } - String errMsg = "addUserCert():" + e.toString(); - - if (e.getLDAPResultCode() == LDAPException.UNAVAILABLE) { - errMsg = "findUsersByCert: " + "Internal DB is unavailable"; - } log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_ADD_USER", e.toString())); throw e; } catch (ELdapException e) { - String errMsg = - "add User Cert: " + - "Could not get connection to internaldb. Error " + e; - log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_ADD_USER", e.toString())); } finally { if (ldapconn != null) @@ -915,19 +869,9 @@ public final class UGSubsystem implements IUGSubsystem { ); } catch (LDAPException e) { - String errMsg = "removeUserCert():" + e; - - if (e.getLDAPResultCode() == LDAPException.UNAVAILABLE) { - errMsg = - "removeUserCert: " + "Internal DB is unavailable"; - } log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_REMOVE_USER", e.toString())); throw new EUsrGrpException(CMS.getUserMessage("CMS_USRGRP_MOD_USER_FAIL")); } catch (ELdapException e) { - String errMsg = - "remove User Cert: " + - "Could not get connection to internaldb. Error " + e; - log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_REMOVE_USER", e.toString())); } finally { if (ldapconn != null) @@ -959,18 +903,10 @@ public final class UGSubsystem implements IUGSubsystem { ldapconn.modify(groupDN, singleChange); } catch (LDAPException e) { - String errMsg = "removeUserFromGroup()" + e.toString(); - - if (e.getLDAPResultCode() == LDAPException.UNAVAILABLE) { - errMsg = "removeUser: " + "Internal DB is unavailable"; - } log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_REMOVE_USER_FROM_GROUP", e.toString())); throw new EUsrGrpException(CMS.getUserMessage("CMS_USRGRP_REMOVE_USER_FAIL")); } catch (ELdapException e) { - String errMsg = - "removeUserFromGroup: Could not get connection to internaldb. Error " + e; - log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_REMOVE_USER_FROM_GROUP", e.toString())); } finally { if (ldapconn != null) @@ -1001,18 +937,10 @@ public final class UGSubsystem implements IUGSubsystem { ); } catch (LDAPException e) { - String errMsg = "removeUser()" + e.toString(); - - if (e.getLDAPResultCode() == LDAPException.UNAVAILABLE) { - errMsg = "removeUser: " + "Internal DB is unavailable"; - } log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_REMOVE_USER", e.toString())); throw new EUsrGrpException(CMS.getUserMessage("CMS_USRGRP_REMOVE_USER_FAIL")); } catch (ELdapException e) { - String errMsg = - "remove User: Could not get connection to internaldb. Error " + e; - log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_REMOVE_USER", e.toString())); } finally { if (ldapconn != null) @@ -1164,18 +1092,9 @@ public final class UGSubsystem implements IUGSubsystem { return buildGroups(res); } catch (LDAPException e) { - String errMsg = - "findGroups: could not find group " + filter + ". Error " + e; - - if (e.getLDAPResultCode() == LDAPException.UNAVAILABLE) { - errMsg = "findGroups: " + "Internal DB is unavailable"; - } log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_FIND_GROUPS", e.toString())); return null; } catch (ELdapException e) { - String errMsg = - "find Groups: Could not get connection to internaldb. Error " + e; - log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_FIND_GROUPS", e.toString())); return null; } finally { @@ -1189,7 +1108,7 @@ public final class UGSubsystem implements IUGSubsystem { if (groups == null || !groups.hasMoreElements()) return null; - return (Group) groups.nextElement(); + return groups.nextElement(); } /** @@ -1217,16 +1136,8 @@ public final class UGSubsystem implements IUGSubsystem { return buildGroups(res); } catch (LDAPException e) { - String errMsg = "listGroups()" + e.toString(); - - if (e.getLDAPResultCode() == LDAPException.UNAVAILABLE) { - errMsg = "listGroups: " + "Internal DB is unavailable"; - } log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_LIST_GROUPS", e.toString())); } catch (ELdapException e) { - String errMsg = - "list Groups: Could not get connection to internaldb. Error " + e; - log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_LIST_GROUPS", e.toString())); } finally { if (ldapconn != null) @@ -1445,8 +1356,7 @@ public final class UGSubsystem implements IUGSubsystem { // that the filter matched, and so the user correctly // authenticated. if (res.hasMoreElements()) { - // actually read the entry - LDAPEntry entry = (LDAPEntry) res.nextElement(); + res.nextElement(); // consume the entry founduser = true; } Debug.trace("authorization result: " + founduser); @@ -1510,18 +1420,10 @@ public final class UGSubsystem implements IUGSubsystem { ldapconn = getConn(); ldapconn.add(entry); } catch (LDAPException e) { - String errMsg = "addGroup()" + e.toString(); - - if (e.getLDAPResultCode() == LDAPException.UNAVAILABLE) { - errMsg = "addGroup: " + "Internal DB is unavailable"; - } log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_ADD_GROUP", e.toString())); throw new EUsrGrpException(CMS.getUserMessage("CMS_USRGRP_ADD_GROUP_FAIL")); } catch (ELdapException e) { - String errMsg = - "add Group: Could not get connection to internaldb. Error " + e; - log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_ADD_GROUP", e.toString())); throw new EUsrGrpException(CMS.getUserMessage("CMS_USRGRP_ADD_GROUP_FAIL")); } finally { @@ -1547,19 +1449,10 @@ public final class UGSubsystem implements IUGSubsystem { ldapconn = getConn(); ldapconn.delete("cn=" + name + "," + getGroupBaseDN()); } catch (LDAPException e) { - String errMsg = "removeGroup()" + e.toString(); - - if (e.getLDAPResultCode() == LDAPException.UNAVAILABLE) { - errMsg = "removeGroup: " + "Internal DB is unavailable"; - } log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_REMOVE_GROUP", e.toString())); throw new EUsrGrpException(CMS.getUserMessage("CMS_USRGRP_REMOVE_GROUP_FAIL")); } catch (ELdapException e) { - String errMsg = - "remove Group: Could not get connection to internaldb. " + - "Error " + e; - log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_REMOVE_GROUP", e.toString())); } finally { if (ldapconn != null) @@ -1612,11 +1505,6 @@ public final class UGSubsystem implements IUGSubsystem { ldapconn.modify("cn=" + grp.getGroupID() + "," + getGroupBaseDN(), mod); } catch (LDAPException e) { - String errMsg = " modifyGroup()" + e.toString(); - - if (e.getLDAPResultCode() == LDAPException.UNAVAILABLE) { - errMsg = "modifyGroup: " + "Internal DB is unavailable"; - } log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_MODIFY_GROUP", e.toString())); throw new EUsrGrpException(CMS.getUserMessage("CMS_USRGRP_MOD_GROUP_FAIL")); @@ -1671,10 +1559,6 @@ public final class UGSubsystem implements IUGSubsystem { return entry.getDN(); } } catch (ELdapException e) { - String errMsg = - "convertUIDtoDN: Could not get connection to internaldb. " + - "Error " + e; - log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_CONVERT_UID", e.toString())); } finally { if (ldapconn != null) diff --git a/pki/base/java-tools/src/com/netscape/cmstools/AuditVerify.java b/pki/base/java-tools/src/com/netscape/cmstools/AuditVerify.java index 435567710..8a8854f8f 100644 --- a/pki/base/java-tools/src/com/netscape/cmstools/AuditVerify.java +++ b/pki/base/java-tools/src/com/netscape/cmstools/AuditVerify.java @@ -153,7 +153,7 @@ public class AuditVerify { } // get list of log files - Vector logFiles = new Vector(); + Vector<String> logFiles = new Vector<String>(); BufferedReader r = new BufferedReader(new FileReader(logListFile)); String listLine; while ((listLine = r.readLine()) != null) { @@ -231,8 +231,6 @@ public class AuditVerify { String sigStopFile = null; int signedLines = 1; - boolean lastLineWasSig = false; - for (int curfile = 0; curfile < logFiles.size(); ++curfile) { String curfileName = (String) logFiles.elementAt(curfile); BufferedReader br = new BufferedReader(new FileReader(curfileName)); diff --git a/pki/base/java-tools/src/com/netscape/cmstools/CMCEnroll.java b/pki/base/java-tools/src/com/netscape/cmstools/CMCEnroll.java index 18bfb51fc..d739fbcff 100644 --- a/pki/base/java-tools/src/com/netscape/cmstools/CMCEnroll.java +++ b/pki/base/java-tools/src/com/netscape/cmstools/CMCEnroll.java @@ -45,7 +45,6 @@ import org.mozilla.jss.asn1.OBJECT_IDENTIFIER; import org.mozilla.jss.asn1.OCTET_STRING; import org.mozilla.jss.asn1.SEQUENCE; import org.mozilla.jss.asn1.SET; -import org.mozilla.jss.crypto.CryptoStore; import org.mozilla.jss.crypto.CryptoToken; import org.mozilla.jss.crypto.DigestAlgorithm; import org.mozilla.jss.crypto.ObjectNotFoundException; @@ -154,8 +153,6 @@ public class CMCEnroll { throw new IOException("Internal Error - " + e.toString()); } - String hasSki = "true"; - BigInteger serialno = signerCert.getSerialNumber(); byte[] certB = signerCert.getEncoded(); X509CertImpl impl = new X509CertImpl(certB); @@ -374,8 +371,6 @@ public class CMCEnroll { Password pass = new Password(pValue.toCharArray()); token.login(pass); - CryptoStore store = token.getCryptoStore(); - X509Certificate[] list = store.getCertificates(); X509Certificate signerCert = null; signerCert = cm.findCertByNickname(nValue); @@ -425,9 +420,10 @@ public class CMCEnroll { asciiBASE64Blob = getCMCBlob(signerCert, cm, nValue, asciiBASE64Blob); // (5) Decode the ASCII BASE 64 blob enclosed in the // String() object into a BINARY BASE 64 byte[] object - byte binaryBASE64Blob[] = null; - binaryBASE64Blob = com.netscape.osutil.OSUtil.AtoB(asciiBASE64Blob); + @SuppressWarnings("unused") + byte binaryBASE64Blob[] = + com.netscape.osutil.OSUtil.AtoB(asciiBASE64Blob); // check for errors // (6) Finally, print the actual CMCEnroll blob to the // specified output file diff --git a/pki/base/java-tools/src/com/netscape/cmstools/CMCRequest.java b/pki/base/java-tools/src/com/netscape/cmstools/CMCRequest.java index 197f29e15..a4368736c 100644 --- a/pki/base/java-tools/src/com/netscape/cmstools/CMCRequest.java +++ b/pki/base/java-tools/src/com/netscape/cmstools/CMCRequest.java @@ -52,7 +52,6 @@ import org.mozilla.jss.asn1.OCTET_STRING; import org.mozilla.jss.asn1.SEQUENCE; import org.mozilla.jss.asn1.SET; import org.mozilla.jss.asn1.UTF8String; -import org.mozilla.jss.crypto.CryptoStore; import org.mozilla.jss.crypto.CryptoToken; import org.mozilla.jss.crypto.DigestAlgorithm; import org.mozilla.jss.crypto.ObjectNotFoundException; @@ -198,7 +197,6 @@ public class CMCRequest { System.out.println("This is not a crmf request. Or this request has an error."); System.exit(1); } - int nummsgs = crmfMsgs.size(); certReqMsg = (CertReqMsg) crmfMsgs.elementAt(0); trq = new TaggedRequest(TaggedRequest.CRMF, null, certReqMsg); @@ -798,7 +796,6 @@ public class CMCRequest { String numRequests = null; String dbdir = null, nickname = null; String ifilename = null, ofilename = null, password = null, format = null; - FileOutputStream outputBlob = null; String confirmCertEnable = "false", confirmCertIssuer = null, confirmCertSerial = null; String getCertEnable = "false", getCertIssuer = null, getCertSerial = null; String dataReturnEnable = "false", dataReturnData = null; @@ -989,8 +986,6 @@ public class CMCRequest { Password pass = new Password(password.toCharArray()); token.login(pass); - CryptoStore store = token.getCryptoStore(); - X509Certificate[] list = store.getCertificates(); X509Certificate signerCert = null; signerCert = cm.findCertByNickname(nickname); diff --git a/pki/base/java-tools/src/com/netscape/cmstools/CMCRevoke.java b/pki/base/java-tools/src/com/netscape/cmstools/CMCRevoke.java index 3be8167a1..57be364d7 100644 --- a/pki/base/java-tools/src/com/netscape/cmstools/CMCRevoke.java +++ b/pki/base/java-tools/src/com/netscape/cmstools/CMCRevoke.java @@ -41,7 +41,6 @@ import org.mozilla.jss.asn1.OCTET_STRING; import org.mozilla.jss.asn1.SEQUENCE; import org.mozilla.jss.asn1.SET; import org.mozilla.jss.asn1.UTF8String; -import org.mozilla.jss.crypto.CryptoStore; import org.mozilla.jss.crypto.CryptoToken; import org.mozilla.jss.crypto.DigestAlgorithm; import org.mozilla.jss.crypto.ObjectNotFoundException; @@ -94,8 +93,6 @@ public class CMCRevoke { */ public static void main(String[] s) { - FileOutputStream outputBlob = null; - // default path is "." String mPath = "."; // default prefix is "" @@ -182,8 +179,6 @@ public class CMCRevoke { Password pass = new Password(hValue.toCharArray()); token.login(pass); - CryptoStore store = token.getCryptoStore(); - X509Certificate[] list = store.getCertificates(); X509Certificate signerCert = null; signerCert = cm.findCertByNickname(nValue); @@ -290,8 +285,6 @@ public class CMCRevoke { try { - String hasSki = "true"; - BigInteger serialno = signerCert.getSerialNumber(); byte[] certB = signerCert.getEncoded(); X509CertImpl impl = new X509CertImpl(certB); diff --git a/pki/base/java-tools/src/com/netscape/cmstools/CRMFPopClient.java b/pki/base/java-tools/src/com/netscape/cmstools/CRMFPopClient.java index 73c56ffea..c45148f79 100644 --- a/pki/base/java-tools/src/com/netscape/cmstools/CRMFPopClient.java +++ b/pki/base/java-tools/src/com/netscape/cmstools/CRMFPopClient.java @@ -192,7 +192,6 @@ public class CRMFPopClient { } public static void main(String args[]) { - String USER_PREFIX = "user"; int argsLen = getRealArgsLength(args); @@ -261,8 +260,6 @@ public class CRMFPopClient { URLConnection conn = null; InputStream is = null; BufferedReader reader = null; - boolean success = false; - int num = 1; long total_time = 0; KeyPair pair = null; @@ -515,7 +512,6 @@ public class CRMFPopClient { while ((line = reader.readLine()) != null) { System.out.println(line); if (line.equals("CMS Enroll Request Success")) { - success = true; System.out.println("Enrollment Successful: ......"); System.out.println(""); } diff --git a/pki/base/java-tools/src/com/netscape/cmstools/DRMTool.java b/pki/base/java-tools/src/com/netscape/cmstools/DRMTool.java index 3b0e8b1ff..c3a91dcd7 100644 --- a/pki/base/java-tools/src/com/netscape/cmstools/DRMTool.java +++ b/pki/base/java-tools/src/com/netscape/cmstools/DRMTool.java @@ -2448,7 +2448,6 @@ public class DRMTool { */ private static String output_dn(String record_type, String line) { - String data = null; String embedded_cn_data[] = null; String embedded_cn_output = null; String input = null; @@ -3955,7 +3954,6 @@ public class DRMTool { */ private static String output_extdata_auth_token_user(String record_type, String line) { - String data = null; String output = null; try { @@ -4003,7 +4001,6 @@ public class DRMTool { */ private static String output_extdata_auth_token_user_dn(String record_type, String line) { - String data = null; String output = null; try { @@ -4310,7 +4307,6 @@ public class DRMTool { * @return true if the DRMTOOL config file is successfully processed */ private static boolean process_drmtool_config_file() { - boolean success = false; BufferedReader reader = null; String line = null; String name_value_pair[] = null; diff --git a/pki/base/java-tools/src/com/netscape/cmstools/PKCS12Export.java b/pki/base/java-tools/src/com/netscape/cmstools/PKCS12Export.java index e9877fd8d..8be0b98dd 100644 --- a/pki/base/java-tools/src/com/netscape/cmstools/PKCS12Export.java +++ b/pki/base/java-tools/src/com/netscape/cmstools/PKCS12Export.java @@ -272,7 +272,7 @@ public class PKCS12Export { if (prikey == null) { debug("Private key is null"); - byte[] localKeyId = addCertBag(certs[i], null, safeContents); + addCertBag(certs[i], null, safeContents); } else { debug("Private key is not null"); byte localKeyId[] = diff --git a/pki/base/java-tools/src/com/netscape/cmstools/PasswordCache.java b/pki/base/java-tools/src/com/netscape/cmstools/PasswordCache.java index e4d8106f7..abb09db62 100644 --- a/pki/base/java-tools/src/com/netscape/cmstools/PasswordCache.java +++ b/pki/base/java-tools/src/com/netscape/cmstools/PasswordCache.java @@ -150,8 +150,6 @@ public class PasswordCache { String mPrefix = ""; String mKeyIdString = null; byte[] mKeyId = null; - String mCertDB = CERTDB; - String mKeyDB = KEYDB; String mCacheFile = "pwcache.db"; String pwdPath = null; @@ -197,7 +195,6 @@ public class PasswordCache { String keyFile = argv[i]; try { BufferedReader r = new BufferedReader(new FileReader(keyFile)); - String listLine; mKeyIdString = r.readLine(); } catch (Exception e) { System.out.println("Error: " + e.toString()); @@ -793,8 +790,6 @@ class PWsdrCache { Process process = Runtime.getRuntime().exec(cmds); process.waitFor(); - BufferedReader pOut = null; - String l = null; if (process.exitValue() == 0) { diff --git a/pki/base/java-tools/src/com/netscape/cmstools/PrettyPrintCert.java b/pki/base/java-tools/src/com/netscape/cmstools/PrettyPrintCert.java index 9d9142927..ddbd95c8d 100644 --- a/pki/base/java-tools/src/com/netscape/cmstools/PrettyPrintCert.java +++ b/pki/base/java-tools/src/com/netscape/cmstools/PrettyPrintCert.java @@ -25,7 +25,6 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.security.cert.CertificateException; -import java.util.Enumeration; import java.util.Locale; import netscape.security.util.CertPrettyPrint; @@ -190,8 +189,6 @@ public class PrettyPrintCert { CertificateSubjectName csn = (CertificateSubjectName) certinfo.get(X509CertInfo.SUBJECT); - Enumeration<String> en = csn.getAttributeNames(); - X500Name dname = (X500Name) csn.get(CertificateSubjectName.DN_NAME); pp = ""; diff --git a/pki/base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java b/pki/base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java index 4e35d982c..c195a78ae 100644 --- a/pki/base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java +++ b/pki/base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java @@ -1133,7 +1133,6 @@ public class KeyRecoveryAuthority implements IAuthority, IKeyService, IKeyRecove String auditSubjectID = auditSubjectID(); String auditRecoveryID = reqID; String auditAgents = ILogger.SIGNED_AUDIT_EMPTY_VALUE; - String auditPublicKey = ILogger.SIGNED_AUDIT_EMPTY_VALUE; IRequestQueue queue = null; IRequest r = null; @@ -1426,7 +1425,6 @@ public class KeyRecoveryAuthority implements IAuthority, IKeyService, IKeyRecove if (nc != null && nc.size() > 0) { // Initialize Request In Queue notification listener IConfigStore rq = nc.getSubStore(PROP_REQ_IN_Q_SUBSTORE); - IAuthority cSub = (IAuthority) this; String requestInQListenerClassName = nc.getString("certificateIssuedListenerClassName", diff --git a/pki/base/kra/src/com/netscape/kra/NetkeyKeygenService.java b/pki/base/kra/src/com/netscape/kra/NetkeyKeygenService.java index 09dc4d95c..ecce2eaa9 100644 --- a/pki/base/kra/src/com/netscape/kra/NetkeyKeygenService.java +++ b/pki/base/kra/src/com/netscape/kra/NetkeyKeygenService.java @@ -301,9 +301,7 @@ public class NetkeyKeygenService implements IService { throws EBaseException { String auditMessage = null; String auditSubjectID = null; - String auditRequesterID = "TPSagent"; String auditArchiveID = ILogger.UNIDENTIFIED; - String auditPublicKey = ILogger.UNIDENTIFIED; byte[] wrapped_des_key; byte iv[] = { 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1 }; diff --git a/pki/base/kra/src/com/netscape/kra/TokenKeyRecoveryService.java b/pki/base/kra/src/com/netscape/kra/TokenKeyRecoveryService.java index 3a860f447..7575ea9f4 100644 --- a/pki/base/kra/src/com/netscape/kra/TokenKeyRecoveryService.java +++ b/pki/base/kra/src/com/netscape/kra/TokenKeyRecoveryService.java @@ -197,9 +197,7 @@ public class TokenKeyRecoveryService implements IService { public boolean serviceRequest(IRequest request) throws EBaseException { String auditMessage = null; String auditSubjectID = null; - String auditRequesterID = "TPSagent"; String auditRecoveryID = ILogger.UNIDENTIFIED; - String auditPublicKey = ILogger.UNIDENTIFIED; String iv_s = ""; CMS.debug("KRA services token key recovery request"); @@ -553,7 +551,9 @@ public class TokenKeyRecoveryService implements IService { privateKeyIn.getSequence(0); DerValue privateKeyDer = new DerValue(privateKeyIn.getOctetString()); DerInputStream privateKeyDerIn = privateKeyDer.data; - BigInt privateKeyVersion = privateKeyDerIn.getInteger(); + + @SuppressWarnings("unused") + BigInt privateKeyVersion = privateKeyDerIn.getInteger(); // consume stream BigInt privateKeyModulus = privateKeyDerIn.getInteger(); BigInt privateKeyExponent = privateKeyDerIn.getInteger(); diff --git a/pki/base/silent/src/com/netscape/pkisilent/ConfigureCA.java b/pki/base/silent/src/com/netscape/pkisilent/ConfigureCA.java index 84dd68a1c..ee41e5a19 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/ConfigureCA.java +++ b/pki/base/silent/src/com/netscape/pkisilent/ConfigureCA.java @@ -261,7 +261,6 @@ public class ConfigureCA { public boolean TokenChoicePanel() { try { - boolean st = false; HTTPResponse hr = null; String query_string = null; @@ -332,9 +331,8 @@ public class ConfigureCA { public boolean DisplayCertChainPanel() { try { - HTTPResponse hr = null; String query_string = "p=4" + "&op=next" + "&xml=true"; - hr = hc.sslConnect(cs_hostname, cs_port, wizard_uri, query_string); + hc.sslConnect(cs_hostname, cs_port, wizard_uri, query_string); return true; } catch (Exception e) { System.out.println("Exception in DisplayCertChainPanel(): " + e.toString()); @@ -345,7 +343,6 @@ public class ConfigureCA { public boolean SecurityDomainLoginPanel() { try { - boolean st = false; HTTPResponse hr = null; String subca_url = "https://" + cs_hostname + ":" + cs_port + @@ -394,7 +391,6 @@ public class ConfigureCA { public boolean CreateCAPanel() { try { - boolean st = false; HTTPResponse hr = null; String query_string = null; @@ -454,7 +450,6 @@ public class ConfigureCA { public boolean HierarchyPanel() { try { - boolean st = false; HTTPResponse hr = null; String query_string = "p=8" + "&op=next" + "&xml=true"; @@ -479,7 +474,6 @@ public class ConfigureCA { public boolean LdapConnectionPanel() { try { - boolean st = false; HTTPResponse hr = null; String query_string = "p=9" + "&op=next" + "&xml=true" + "&host=" @@ -509,7 +503,6 @@ public class ConfigureCA { public boolean KeyPanel() { try { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); @@ -602,7 +595,6 @@ public class ConfigureCA { public boolean CertSubjectPanel() { try { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); @@ -749,7 +741,6 @@ public class ConfigureCA { public boolean CertificatePanel() { try { - boolean st = false; HTTPResponse hr = null; String query_string = "p=12" + "&op=next" + "&xml=true" + "&subsystem=" @@ -778,14 +769,12 @@ public class ConfigureCA { public boolean CertificatePanelExternal() { try { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); ArrayList<String> req_list = null; ArrayList<String> cert_list = null; ArrayList<String> dn_list = null; - ArrayList<String> pp_list = null; String genString = "...certificate be generated internally..."; String query_string = "p=12" + "&op=apply" + "&xml=true" + "&subsystem=" @@ -873,7 +862,6 @@ public class ConfigureCA { public boolean BackupPanel() { try { - boolean st = false; HTTPResponse hr = null; if (save_p12.equalsIgnoreCase("true")) { @@ -906,7 +894,7 @@ public class ConfigureCA { String line = null; while ((line = br.readLine()) != null) System.out.println("Error: " + line); - int exitVal = proc.waitFor(); + proc.waitFor(); // verify p12 file // Decode the P12 file @@ -977,7 +965,6 @@ public class ConfigureCA { public boolean AdminCertReqPanel() { try { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); @@ -1087,7 +1074,6 @@ public class ConfigureCA { public boolean UpdateDomainPanel() { try { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); diff --git a/pki/base/silent/src/com/netscape/pkisilent/ConfigureOCSP.java b/pki/base/silent/src/com/netscape/pkisilent/ConfigureOCSP.java index bf599ed4c..254d9bcec 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/ConfigureOCSP.java +++ b/pki/base/silent/src/com/netscape/pkisilent/ConfigureOCSP.java @@ -611,8 +611,6 @@ public class ConfigureOCSP { ParseXML px = new ParseXML(); String admin_cert_request = null; - String cert_subject = "CN=ocsp-" + admin_user; - ComCrypto cCrypt = new ComCrypto(client_certdb_dir, client_certdb_pwd, agent_cert_subject, diff --git a/pki/base/silent/src/com/netscape/pkisilent/ConfigureRA.java b/pki/base/silent/src/com/netscape/pkisilent/ConfigureRA.java index d8a6c7feb..cade95fa8 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/ConfigureRA.java +++ b/pki/base/silent/src/com/netscape/pkisilent/ConfigureRA.java @@ -255,7 +255,6 @@ public class ConfigureRA { px.prettyprintxml(); sleep_time(); - String ca_url = "https://" + ca_hostname + ":" + ca_ssl_port; // CA choice panel query_string = "p=4" + @@ -381,8 +380,6 @@ public class ConfigureRA { ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - String ca_url = "https://" + ca_hostname + ":" + ca_ssl_port; - String query_string = "p=9" + "&sslserver=" + URLEncoder.encode(ra_server_cert_subject_name) + diff --git a/pki/base/silent/src/com/netscape/pkisilent/ConfigureSubCA.java b/pki/base/silent/src/com/netscape/pkisilent/ConfigureSubCA.java index 4c33a8479..62947e4a2 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/ConfigureSubCA.java +++ b/pki/base/silent/src/com/netscape/pkisilent/ConfigureSubCA.java @@ -297,18 +297,13 @@ public class ConfigureSubCA { } public boolean SecurityDomainLoginPanel() { - boolean st = false; - HTTPResponse hr = null; - ByteArrayInputStream bais = null; - ParseXML px = new ParseXML(); - String subca_url = "https://" + cs_hostname + ":" + cs_port + "/ca/admin/console/config/wizard" + "?p=5&subsystem=CA"; String query_string = "url=" + URLEncoder.encode(subca_url); - hr = hc.sslConnect(sd_hostname, sd_admin_port, sd_login_uri, query_string); + HTTPResponse hr = hc.sslConnect(sd_hostname, sd_admin_port, sd_login_uri, query_string); String query_string_1 = "uid=" + sd_admin_name + "&pwd=" + URLEncoder.encode(sd_admin_password) + @@ -340,20 +335,14 @@ public class ConfigureSubCA { } public boolean DisplayChainPanel() { - boolean st = false; - HTTPResponse hr = null; - ByteArrayInputStream bais = null; - ParseXML px = new ParseXML(); - String query_string = null; - - query_string = "p=5" + "&op=next" + "&xml=true" + + String query_string = "p=5" + "&op=next" + "&xml=true" + "&choice=newsubsystem" + "&subsystemName=" + URLEncoder.encode(subsystem_name) + "&subsystemName=" + URLEncoder.encode(subsystem_name) + "&urls=0"; - hr = hc.sslConnect(cs_hostname, cs_port, wizard_uri, query_string); + hc.sslConnect(cs_hostname, cs_port, wizard_uri, query_string); // parse xml // bais = new ByteArrayInputStream(hr.getHTML().getBytes()); // px.parse(bais); @@ -493,8 +482,6 @@ public class ConfigureSubCA { ArrayList<String> cert_list = null; ArrayList<String> dn_list = null; - String domain_url = "https://" + ca_hostname + ":" + ca_ssl_port; - String query_string = "p=11" + "&op=next" + "&xml=true" + "&signing=" + URLEncoder.encode(subca_sign_cert_subject_name) + @@ -574,14 +561,9 @@ public class ConfigureSubCA { } public boolean CertificatePanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList<String> req_list = null; - ArrayList<String> cert_list = null; - ArrayList<String> dn_list = null; - ArrayList<String> pp_list = null; String query_string = "p=12" + "&op=next" + "&xml=true" + "&signing=" + @@ -654,14 +636,11 @@ public class ConfigureSubCA { } public boolean AdminCertReqPanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); String admin_cert_request = null; - String cert_subject = "CN=" + "subca-" + admin_user; - ComCrypto cCrypt = new ComCrypto(client_certdb_dir, client_certdb_pwd, agent_cert_subject, @@ -716,15 +695,12 @@ public class ConfigureSubCA { public boolean AdminCertImportPanel() { boolean st = false; - HTTPResponse hr = null; - ByteArrayInputStream bais = null; - ParseXML px = new ParseXML(); String query_string = "serialNumber=" + admin_serial_number + "&importCert=" + "true" + ""; - hr = hc.sslConnect(cs_hostname, cs_port, admin_uri, query_string); + HTTPResponse hr = hc.sslConnect(cs_hostname, cs_port, admin_uri, query_string); // get response data // String cert_to_import = diff --git a/pki/base/silent/src/com/netscape/pkisilent/ConfigureTKS.java b/pki/base/silent/src/com/netscape/pkisilent/ConfigureTKS.java index acc699673..5fad4790e 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/ConfigureTKS.java +++ b/pki/base/silent/src/com/netscape/pkisilent/ConfigureTKS.java @@ -268,14 +268,8 @@ public class ConfigureTKS { } public boolean DisplayChainPanel() { - boolean st = false; - HTTPResponse hr = null; - ByteArrayInputStream bais = null; - ParseXML px = new ParseXML(); - String query_string = null; - - query_string = "p=4" + "&op=next" + "&xml=true"; - hr = hc.sslConnect(cs_hostname, cs_port, wizard_uri, query_string); + String query_string = "p=4" + "&op=next" + "&xml=true"; + hc.sslConnect(cs_hostname, cs_port, wizard_uri, query_string); // parse xml // bais = new ByteArrayInputStream(hr.getHTML().getBytes()); // px.parse(bais); @@ -286,18 +280,13 @@ public class ConfigureTKS { } public boolean SecurityDomainLoginPanel() { - boolean st = false; - HTTPResponse hr = null; - ByteArrayInputStream bais = null; - ParseXML px = new ParseXML(); - String tks_url = "https://" + cs_hostname + ":" + cs_port + "/tks/admin/console/config/wizard" + "?p=5&subsystem=TKS"; String query_string = "url=" + URLEncoder.encode(tks_url); - hr = hc.sslConnect(sd_hostname, sd_admin_port, sd_login_uri, query_string); + HTTPResponse hr = hc.sslConnect(sd_hostname, sd_admin_port, sd_login_uri, query_string); String query_string_1 = "uid=" + sd_admin_name + "&pwd=" + URLEncoder.encode(sd_admin_password) + @@ -490,14 +479,9 @@ public class ConfigureTKS { } public boolean CertificatePanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList<String> req_list = null; - ArrayList<String> cert_list = null; - ArrayList<String> dn_list = null; - ArrayList<String> pp_list = null; String query_string = "p=10" + "&op=next" + "&xml=true" + "&subsystem=" + @@ -544,14 +528,9 @@ public class ConfigureTKS { } public boolean SavePKCS12Panel() { - boolean st = false; - HTTPResponse hr = null; - ByteArrayInputStream bais = null; - ParseXML px = new ParseXML(); - String query_string = ""; - hr = hc.sslConnect(cs_hostname, cs_port, pkcs12_uri, query_string); + HTTPResponse hr = hc.sslConnect(cs_hostname, cs_port, pkcs12_uri, query_string); // dump hr.getResponseData() to file @@ -595,14 +574,11 @@ public class ConfigureTKS { } public boolean AdminCertReqPanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); String admin_cert_request = null; - String cert_subject = "CN=tks-" + admin_user; - ComCrypto cCrypt = new ComCrypto(client_certdb_dir, client_certdb_pwd, agent_cert_subject, @@ -656,15 +632,12 @@ public class ConfigureTKS { public boolean AdminCertImportPanel() { boolean st = false; - HTTPResponse hr = null; - ByteArrayInputStream bais = null; - ParseXML px = new ParseXML(); String query_string = "serialNumber=" + admin_serial_number + "&importCert=" + "true" + ""; - hr = hc.sslConnect(sd_hostname, sd_admin_port, admin_uri, query_string); + HTTPResponse hr = hc.sslConnect(sd_hostname, sd_admin_port, admin_uri, query_string); // get response data // String cert_to_import = diff --git a/pki/base/silent/src/com/netscape/pkisilent/ConfigureTPS.java b/pki/base/silent/src/com/netscape/pkisilent/ConfigureTPS.java index 10cdc7821..4982a2f2d 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/ConfigureTPS.java +++ b/pki/base/silent/src/com/netscape/pkisilent/ConfigureTPS.java @@ -20,7 +20,6 @@ package com.netscape.pkisilent; import java.io.ByteArrayInputStream; import java.net.URLEncoder; -import java.util.ArrayList; import com.netscape.osutil.OSUtil; import com.netscape.pkisilent.argparser.ArgParser; @@ -221,32 +220,21 @@ public class ConfigureTPS { } public boolean DisplayChainPanel() { - boolean st = false; - HTTPResponse hr = null; - ByteArrayInputStream bais = null; - ParseXML px = new ParseXML(); - String query_string = null; - - query_string = "p=4" + "&op=next" + "&xml=true"; - hr = hc.sslConnect(cs_hostname, cs_port, wizard_uri, query_string); + String query_string = "p=4" + "&op=next" + "&xml=true"; + hc.sslConnect(cs_hostname, cs_port, wizard_uri, query_string); return true; } public boolean SecurityDomainLoginPanel() { - boolean st = false; - HTTPResponse hr = null; - ByteArrayInputStream bais = null; - ParseXML px = new ParseXML(); - String tps_url = "https://" + cs_hostname + ":" + cs_port + "/tps/admin/console/config/wizard" + "?p=3&subsystem=TPS"; String query_string = "url=" + URLEncoder.encode(tps_url) + ""; - hr = hc.sslConnect(sd_hostname, sd_admin_port, sd_login_uri, query_string); + HTTPResponse hr = hc.sslConnect(sd_hostname, sd_admin_port, sd_login_uri, query_string); String query_string_1 = "uid=" + sd_admin_name + "&pwd=" + URLEncoder.encode(sd_admin_password) + @@ -302,7 +290,6 @@ public class ConfigureTPS { px.prettyprintxml(); sleep_time(); - String ca_url = "https://" + ca_hostname + ":" + ca_ssl_port; // CA choice panel query_string = "p=6" + @@ -337,8 +324,6 @@ public class ConfigureTPS { ss_keygen = "keygen"; } - String drm_url = "https://" + drm_hostname + ":" + drm_ssl_port; - query_string = "p=8" + "&choice=" + ss_keygen + "&urls=0" + @@ -474,12 +459,9 @@ public class ConfigureTPS { } public boolean KeyPanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList<String> friendly_list = null; - ArrayList<String> dn_list = null; String query_string = "p=11" + "&keytype=" + key_type + @@ -508,16 +490,9 @@ public class ConfigureTPS { } public boolean CertSubjectPanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList<String> req_list = null; - ArrayList<String> cert_list = null; - ArrayList<String> dn_list = null; - ArrayList<String> friendly_list = null; - - String ca_url = "https://" + ca_hostname + ":" + ca_ssl_port; String query_string = "p=12" + "&sslserver=" + @@ -549,14 +524,9 @@ public class ConfigureTPS { } public boolean CertificatePanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList<String> req_list = null; - ArrayList<String> cert_list = null; - ArrayList<String> dn_list = null; - ArrayList<String> pp_list = null; String query_string = "p=13" + "&sslserver=" + diff --git a/pki/base/silent/src/com/netscape/pkisilent/argparser/ArgParser.java b/pki/base/silent/src/com/netscape/pkisilent/argparser/ArgParser.java index d6f02d9c6..ed5f98b1d 100755 --- a/pki/base/silent/src/com/netscape/pkisilent/argparser/ArgParser.java +++ b/pki/base/silent/src/com/netscape/pkisilent/argparser/ArgParser.java @@ -811,7 +811,6 @@ public class ArgParser { } } if (outOfRange) { - String errmsg = "value " + s + " not in range "; throw new ArgParseException( name, "value '" + s + "' not in range " + rangeDesc); } @@ -1040,7 +1039,6 @@ public class ArgParser { private void scanRangeSpec(Record rec, String s) throws IllegalArgumentException { StringScanner scanner = new StringScanner(s); - int i0, i = 1; char c, c0, c1; scanner.setStringDelimiters(")],}"); diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/CMSLDAP.java b/pki/base/silent/src/com/netscape/pkisilent/common/CMSLDAP.java index d0222897d..91a273df6 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/common/CMSLDAP.java +++ b/pki/base/silent/src/com/netscape/pkisilent/common/CMSLDAP.java @@ -463,12 +463,10 @@ public class CMSLDAP { **/ public boolean TurnOnSSL(String certPrefix, String certName, String sslport) { - String dn; String CIPHERS = "-rsa_null_md5,+rsa_fips_3des_sha,+rsa_fips_des_sha,+rsa_3des_sha,+rsa_rc4_128_md5,+rsa_des_sha,+rsa_rc2_40_md5,+rsa_rc4_40_md5"; try { - boolean found = false; int searchScope = LDAPv2.SCOPE_SUB; String getAttrs[] = { "nssslactivation" }; @@ -507,9 +505,10 @@ public class CMSLDAP { // conn.delete("cn=RSA,cn=encryption,cn=config"); try { - LDAPSearchResults results = conn.search( + conn.search( "cn=RSA,cn=encryption,cn=config", searchScope, null, - getAttrs, false); + getAttrs, false); // check for errors + LDAPAttribute cn = new LDAPAttribute("cn", "RSA"); LDAPAttribute ssltoken = new LDAPAttribute("nsssltoken", "internal (software)"); diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/ComCrypto.java b/pki/base/silent/src/com/netscape/pkisilent/common/ComCrypto.java index d619afcc2..1c10db8fb 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/common/ComCrypto.java +++ b/pki/base/silent/src/com/netscape/pkisilent/common/ComCrypto.java @@ -18,11 +18,7 @@ package com.netscape.pkisilent.common; // All rights reserved. // --- END COPYRIGHT BLOCK --- -import java.io.BufferedReader; import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.net.URL; -import java.net.URLConnection; import java.security.KeyPair; import netscape.security.x509.X500Name; @@ -492,13 +488,6 @@ public class ComCrypto { } public String generateCRMFrequest() { - URL url = null; - URLConnection conn = null; - InputStream is = null; - BufferedReader reader = null; - boolean success = false; - int num = 1; - long total_time = 0; KeyPair pair = null; System.out.println("Debug : initialize crypto Manager"); @@ -622,9 +611,6 @@ public class ComCrypto { public String generateCRMFtransport() { - boolean success = false; - int num = 1; - long total_time = 0; KeyPair pair = null; try { diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/Request.java b/pki/base/silent/src/com/netscape/pkisilent/common/Request.java index 9ee700013..0f0827d67 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/common/Request.java +++ b/pki/base/silent/src/com/netscape/pkisilent/common/Request.java @@ -349,7 +349,6 @@ public class Request extends TestClient { String AUTHID = "header.authorityid = "; String seqnum = "record.seqNum"; - int size = s.capacity(); String res = s.toString(); int ret = 0; @@ -635,7 +634,6 @@ public class Request extends TestClient { StringBuffer s = new StringBuffer(); s = con.getPage(); - String line; if (debug) { System.out.println(s.toString()); @@ -967,7 +965,6 @@ public class Request extends TestClient { seqNumFrom = x.intValue(); Integer y = new Integer(To); - int t = y.intValue(); if ((y.intValue() - seqNumFrom) > 50) { maxCount = 50; diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/checkRequest.java b/pki/base/silent/src/com/netscape/pkisilent/common/checkRequest.java index 99a6e0849..c4599ffde 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/common/checkRequest.java +++ b/pki/base/silent/src/com/netscape/pkisilent/common/checkRequest.java @@ -257,7 +257,6 @@ public class checkRequest extends TestClient { FileOutputStream fos = new FileOutputStream(certfile); if (ldapformat.equals("true")) { - Integer m = new Integer("1"); String tmp = "description: 2;" + Integer.parseInt(serialNumber, 16) + ";" + issuer + ";" + subject + "\n"; diff --git a/pki/base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java b/pki/base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java index c2ac547e6..98b8a0bd1 100644 --- a/pki/base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java +++ b/pki/base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java @@ -328,11 +328,7 @@ public class CryptoUtil { * formats a cert request */ public static String reqFormat(String content) { - int beginIndex = CERTREQ_BEGIN_HEADING.length(); - int endIndex = CERTREQ_END_HEADING.length(); - String result = CERTREQ_BEGIN_HEADING + "\n"; - int index = 0; while (content.length() >= LINE_COUNT) { result = result + content.substring(0, LINE_COUNT) + "\n"; @@ -392,11 +388,7 @@ public class CryptoUtil { if (content == null || content.length() == 0) { return ""; } - int beginIndex = CERT_BEGIN_HEADING.length(); - int endIndex = CERT_END_HEADING.length(); - String result = CERT_BEGIN_HEADING + "\n"; - int index = 0; while (content.length() >= LINE_COUNT) { result = result + content.substring(0, LINE_COUNT) + "\n"; @@ -997,14 +989,14 @@ public class CryptoUtil { while (enums.hasMoreElements()) { CryptoToken token = (CryptoToken) enums.nextElement(); - String tokenName = token.getName(); CryptoStore store = token.getCryptoStore(); org.mozilla.jss.crypto.X509Certificate list[] = store.getCertificates(); for (int i = 0; i < list.length; i++) { try { - PrivateKey key = cm.findPrivKeyByCert(list[i]); + @SuppressWarnings("unused") + PrivateKey key = cm.findPrivKeyByCert(list[i]); // check for errors X509CertImpl impl = null; try { diff --git a/pki/base/util/src/com/netscape/cmsutil/http/HttpClient.java b/pki/base/util/src/com/netscape/cmsutil/http/HttpClient.java index 2ad67578f..438c70c23 100644 --- a/pki/base/util/src/com/netscape/cmsutil/http/HttpClient.java +++ b/pki/base/util/src/com/netscape/cmsutil/http/HttpClient.java @@ -198,9 +198,6 @@ public class HttpClient { //System.out.println(content); if (args.length >= 4 && args[3].equalsIgnoreCase("keep-alive")) { - int len; - char[] msgbody; - for (int i = 0; i < 2; i++) { if (i == 1) req.setHeader("Connection", "Close"); diff --git a/pki/base/util/src/com/netscape/cmsutil/http/JssSSLSocketFactory.java b/pki/base/util/src/com/netscape/cmsutil/http/JssSSLSocketFactory.java index d0bef4b2a..c2013a5d2 100644 --- a/pki/base/util/src/com/netscape/cmsutil/http/JssSSLSocketFactory.java +++ b/pki/base/util/src/com/netscape/cmsutil/http/JssSSLSocketFactory.java @@ -23,7 +23,6 @@ import java.net.SocketException; import java.net.UnknownHostException; import org.mozilla.jss.CryptoManager; -import org.mozilla.jss.crypto.X509Certificate; import org.mozilla.jss.ssl.SSLCertificateApprovalCallback; import org.mozilla.jss.ssl.SSLClientCertificateSelectionCallback; import org.mozilla.jss.ssl.SSLHandshakeCompletedEvent; diff --git a/pki/base/util/src/com/netscape/cmsutil/scep/CRSPKIMessage.java b/pki/base/util/src/com/netscape/cmsutil/scep/CRSPKIMessage.java index a5dd108ae..03bc68723 100644 --- a/pki/base/util/src/com/netscape/cmsutil/scep/CRSPKIMessage.java +++ b/pki/base/util/src/com/netscape/cmsutil/scep/CRSPKIMessage.java @@ -241,7 +241,6 @@ public class CRSPKIMessage { // getHashAlgorithm is added to work around issue 636217 private String getHashAlgorithm(OBJECT_IDENTIFIER algorithmOID) { String hashAlgorithm = null; - OBJECT_IDENTIFIER oid = MD5_DIGEST; if (algorithmOID != null) { if (algorithmOID.equals(MD5_DIGEST)) { hashAlgorithm = "MD5"; diff --git a/pki/base/util/src/com/netscape/cmsutil/util/Utils.java b/pki/base/util/src/com/netscape/cmsutil/util/Utils.java index 07916fb6a..06892fd84 100644 --- a/pki/base/util/src/com/netscape/cmsutil/util/Utils.java +++ b/pki/base/util/src/com/netscape/cmsutil/util/Utils.java @@ -60,8 +60,6 @@ public class Utils { } Process process = Runtime.getRuntime().exec(cmds); process.waitFor(); - BufferedReader pOut = null; - String l = null; if (process.exitValue() == 0) { /** diff --git a/pki/base/util/src/netscape/security/acl/OwnerImpl.java b/pki/base/util/src/netscape/security/acl/OwnerImpl.java index 2e96cfaaa..3f47a1dd8 100644 --- a/pki/base/util/src/netscape/security/acl/OwnerImpl.java +++ b/pki/base/util/src/netscape/security/acl/OwnerImpl.java @@ -85,7 +85,7 @@ public class OwnerImpl implements Owner { // // check if there is atleast 2 members left. // - Object o = e.nextElement(); + e.nextElement(); // consume next element if (e.hasMoreElements()) return ownerGroup.removeMember(owner); else diff --git a/pki/base/util/src/netscape/security/pkcs/PKCS10.java b/pki/base/util/src/netscape/security/pkcs/PKCS10.java index b8c0aedc4..cb0e6edf4 100644 --- a/pki/base/util/src/netscape/security/pkcs/PKCS10.java +++ b/pki/base/util/src/netscape/security/pkcs/PKCS10.java @@ -141,10 +141,9 @@ public class PKCS10 { // // Inner sequence: version, name, key, attributes // - BigInt serial; - DerValue val; + @SuppressWarnings("unused") + BigInt serial = seq[0].data.getInteger(); // consume serial - serial = seq[0].data.getInteger(); /* if (serial.toInt () != 0) throw new IllegalArgumentException ("not PKCS #10 v1"); @@ -156,8 +155,6 @@ public class PKCS10 { subjectPublicKeyInfo = X509Key.parse(new DerValue(val1)); PublicKey publicKey = X509Key.parsePublicKey(new DerValue(val1)); - String keystr = subjectPublicKeyInfo.toString(); - // Cope with a somewhat common illegal PKCS #10 format if (seq[0].data.available() != 0) attributeSet = new PKCS10Attributes(seq[0].data); diff --git a/pki/base/util/src/netscape/security/pkcs/PKCS8Key.java b/pki/base/util/src/netscape/security/pkcs/PKCS8Key.java index 6fc89610a..7c5f64582 100644 --- a/pki/base/util/src/netscape/security/pkcs/PKCS8Key.java +++ b/pki/base/util/src/netscape/security/pkcs/PKCS8Key.java @@ -31,7 +31,6 @@ import java.security.Provider; import java.security.Security; import java.security.spec.InvalidKeySpecException; import java.security.spec.PKCS8EncodedKeySpec; -import java.util.Properties; import netscape.security.util.BigInt; import netscape.security.util.DerOutputStream; @@ -171,8 +170,6 @@ public class PKCS8Key implements PrivateKey { */ String classname = ""; try { - Properties props; - String keytype; Provider sunProvider; sunProvider = Security.getProvider("SUN"); diff --git a/pki/base/util/src/netscape/security/provider/SHA.java b/pki/base/util/src/netscape/security/provider/SHA.java index 5aed99264..42a6b8b90 100644 --- a/pki/base/util/src/netscape/security/provider/SHA.java +++ b/pki/base/util/src/netscape/security/provider/SHA.java @@ -112,7 +112,6 @@ public class SHA extends MessageDigestSpi implements Cloneable { */ public void engineUpdate(byte b[], int off, int len) { int word; - int offset; if ((off < 0) || (len < 0) || (off + len > b.length)) throw new ArrayIndexOutOfBoundsException(); @@ -179,7 +178,7 @@ public class SHA extends MessageDigestSpi implements Cloneable { byte hashvalue[] = new byte[SHA_LENGTH]; try { - int outLen = engineDigest(hashvalue, 0, hashvalue.length); + engineDigest(hashvalue, 0, hashvalue.length); } catch (DigestException e) { throw new InternalError(""); } diff --git a/pki/base/util/src/netscape/security/x509/IssuingDistributionPointExtension.java b/pki/base/util/src/netscape/security/x509/IssuingDistributionPointExtension.java index fc7e837ce..d5f5100bf 100644 --- a/pki/base/util/src/netscape/security/x509/IssuingDistributionPointExtension.java +++ b/pki/base/util/src/netscape/security/x509/IssuingDistributionPointExtension.java @@ -196,7 +196,9 @@ public class IssuingDistributionPointExtension extends Extension try { BitArray reasons = opt.getUnalignedBitString(); issuingDistributionPoint.setOnlySomeReasons(reasons); - byte[] a = reasons.toByteArray(); + + @SuppressWarnings("unused") + byte[] a = reasons.toByteArray(); // check for errors } catch (IOException e) { throw new IOException("Invalid encoding of IssuingDistributionPoint " + e); } diff --git a/pki/base/util/src/netscape/security/x509/LdapV3DNStrConverter.java b/pki/base/util/src/netscape/security/x509/LdapV3DNStrConverter.java index 52ff67017..1245cc6bd 100644 --- a/pki/base/util/src/netscape/security/x509/LdapV3DNStrConverter.java +++ b/pki/base/util/src/netscape/security/x509/LdapV3DNStrConverter.java @@ -108,8 +108,6 @@ public class LdapV3DNStrConverter extends LdapDNStrConverter { throws IOException { StringReader dn_reader = new StringReader(dn); PushbackReader in = new PushbackReader(dn_reader, 5); - Vector<RDN> rdnVector = new Vector<RDN>(); - RDN[] names; return parseDN(in, encodingOrder); } diff --git a/pki/base/util/src/netscape/security/x509/X509CertImpl.java b/pki/base/util/src/netscape/security/x509/X509CertImpl.java index d2d77cb3a..9c62b36a6 100755 --- a/pki/base/util/src/netscape/security/x509/X509CertImpl.java +++ b/pki/base/util/src/netscape/security/x509/X509CertImpl.java @@ -1195,7 +1195,8 @@ public class X509CertImpl extends X509Certificate */ protected Object readResolve() throws java.io.ObjectStreamException { try { - CertificateFactory cf = CertificateFactory.getInstance(type1); + @SuppressWarnings("unused") + CertificateFactory cf = CertificateFactory.getInstance(type1); // check for errors return new X509CertImpl(data1); /* diff --git a/pki/base/util/src/netscape/security/x509/X509Key.java b/pki/base/util/src/netscape/security/x509/X509Key.java index 546ce363e..a8253c0d8 100644 --- a/pki/base/util/src/netscape/security/x509/X509Key.java +++ b/pki/base/util/src/netscape/security/x509/X509Key.java @@ -30,7 +30,6 @@ import java.security.PublicKey; import java.security.Security; import java.security.spec.InvalidKeySpecException; import java.security.spec.X509EncodedKeySpec; -import java.util.Properties; import netscape.security.util.DerOutputStream; import netscape.security.util.DerValue; @@ -185,8 +184,6 @@ public class X509Key implements PublicKey { */ String classname = ""; try { - Properties props; - String keytype; Provider sunProvider; sunProvider = Security.getProvider("SUN"); |