From 3f24e55923fc986af4c6a08b2b8d45704a905627 Mon Sep 17 00:00:00 2001 From: Endi Sukma Dewata Date: Thu, 5 Apr 2012 15:08:18 -0500 Subject: Removed unnecessary type casts. Unnecessary type casts have been removed using Eclipse Quick Fix. Ticket #134 --- base/ca/src/com/netscape/ca/CAService.java | 4 ++-- base/ca/src/com/netscape/ca/CRLIssuingPoint.java | 24 +++++++++++----------- .../src/com/netscape/ca/CertificateAuthority.java | 8 ++++---- 3 files changed, 18 insertions(+), 18 deletions(-) (limited to 'base/ca/src') diff --git a/base/ca/src/com/netscape/ca/CAService.java b/base/ca/src/com/netscape/ca/CAService.java index 919f01e96..21702d90c 100644 --- a/base/ca/src/com/netscape/ca/CAService.java +++ b/base/ca/src/com/netscape/ca/CAService.java @@ -689,7 +689,7 @@ public class CAService implements ICAService, IService { Enumeration e = exts.getAttributes(); while (e.hasMoreElements()) { - netscape.security.x509.Extension ext = (netscape.security.x509.Extension) e.nextElement(); + netscape.security.x509.Extension ext = e.nextElement(); if (ext.getExtensionId().toString().equals(PKIXExtensions.BasicConstraints_Id.toString())) { bc_ext = (BasicConstraintsExtension) ext; @@ -1004,7 +1004,7 @@ public class CAService implements ICAService, IService { Enumeration eIPs = mCRLIssuingPoints.elements(); while (eIPs.hasMoreElements()) { - ICRLIssuingPoint ip = (ICRLIssuingPoint) eIPs.nextElement(); + ICRLIssuingPoint ip = eIPs.nextElement(); if (ip != null) { boolean b = true; diff --git a/base/ca/src/com/netscape/ca/CRLIssuingPoint.java b/base/ca/src/com/netscape/ca/CRLIssuingPoint.java index e55c95cfd..f2ca2026c 100644 --- a/base/ca/src/com/netscape/ca/CRLIssuingPoint.java +++ b/base/ca/src/com/netscape/ca/CRLIssuingPoint.java @@ -1500,14 +1500,14 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable { TimeZone tz = TimeZone.getDefault(); int offset = tz.getOffset(now); long oneDay = 1440L * MINUTE; - long nowToday = (now + (long) offset) % oneDay; + long nowToday = (now + offset) % oneDay; long startOfToday = now - nowToday; long lastUpdated = (mLastUpdate != null) ? mLastUpdate.getTime() : now; - long lastUpdateDay = lastUpdated - ((lastUpdated + (long) offset) % oneDay); + long lastUpdateDay = lastUpdated - ((lastUpdated + offset) % oneDay); long lastUpdate = (mLastUpdate != null && fromLastUpdate) ? mLastUpdate.getTime() : now; - long last = (lastUpdate + (long) offset) % oneDay; + long last = (lastUpdate + offset) % oneDay; long lastDay = lastUpdate - last; boolean isDeltaEnabled = isDeltaCRLEnabled(); @@ -1537,7 +1537,7 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable { if (mDailyUpdates.size() == 1 && mDailyUpdates.elementAt(0).size() == 1 && mEnableUpdateFreq && mAutoUpdateInterval > 0) { // Interval updates with starting time - long firstTime = MINUTE * ((Integer) mDailyUpdates.elementAt(0).elementAt(0)).longValue(); + long firstTime = MINUTE * mDailyUpdates.elementAt(0).elementAt(0).longValue(); long t = firstTime; long interval = mAutoUpdateInterval; if (mExtendedNextUpdate && (!fromLastUpdate) && (!delta) && @@ -1580,7 +1580,7 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable { } // search the current day for (i = 0; i < mDailyUpdates.elementAt(mCurrentDay).size(); i++) { - long t = MINUTE * ((Integer) mDailyUpdates.elementAt(mCurrentDay).elementAt(i)).longValue(); + long t = MINUTE * mDailyUpdates.elementAt(mCurrentDay).elementAt(i).longValue(); if (mEnableDailyUpdates && mExtendedTimeList) { if (mExtendedNextUpdate && (!fromLastUpdate) && (!delta) && isDeltaEnabled) { if (t < 0) { @@ -1607,7 +1607,7 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable { if (i < mDailyUpdates.elementAt(mCurrentDay).size()) { // found inside the current day - next = (MINUTE * ((Integer) mDailyUpdates.elementAt(mCurrentDay).elementAt(i)).longValue()); + next = (MINUTE * mDailyUpdates.elementAt(mCurrentDay).elementAt(i).longValue()); if (mEnableDailyUpdates && mExtendedTimeList && next < 0) { next *= -1; if (fromLastUpdate) { @@ -1637,7 +1637,7 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable { if (j < mDailyUpdates.elementAt(nextDay).size()) { if (nextDay == 0 && (!(mEnableDailyUpdates && mExtendedTimeList))) j = 0; - t = MINUTE * ((Integer) mDailyUpdates.elementAt(nextDay).elementAt(j)).longValue(); + t = MINUTE * mDailyUpdates.elementAt(nextDay).elementAt(j).longValue(); if (mEnableDailyUpdates && mExtendedTimeList) { if (mExtendedNextUpdate && (!fromLastUpdate) && (!delta) && isDeltaEnabled) { if (t < 0) { @@ -2018,7 +2018,7 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable { int k; for (k = 0; k < exts.size(); k++) { - Extension ext = (Extension) exts.elementAt(k); + Extension ext = exts.elementAt(k); String name = mCMSCRLExtensions.getCRLExtensionName( ext.getExtensionId().toString()); @@ -2085,7 +2085,7 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable { RevokedCertImpl newRevokedCert = new RevokedCertImpl(serialNumber, revocationDate, entryExt); - mRevokedCerts.put(serialNumber, (RevokedCertificate) newRevokedCert); + mRevokedCerts.put(serialNumber, newRevokedCert); } } else if (certType == UNREVOKED_CERT) { if (mRevokedCerts.containsKey(serialNumber)) { @@ -2101,7 +2101,7 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable { RevokedCertImpl newRevokedCert = new RevokedCertImpl(serialNumber, CMS.getCurrentDate(), entryExt); - mUnrevokedCerts.put(serialNumber, (RevokedCertificate) newRevokedCert); + mUnrevokedCerts.put(serialNumber, newRevokedCert); } } } @@ -2177,7 +2177,7 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable { RevokedCertImpl newRevokedCert = new RevokedCertImpl(serialNumber, CMS.getCurrentDate(), entryExt); - mExpiredCerts.put(serialNumber, (RevokedCertificate) newRevokedCert); + mExpiredCerts.put(serialNumber, newRevokedCert); } if (mCacheUpdateInterval == 0) { @@ -2221,7 +2221,7 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable { if (crlExtensions != null) { for (int k = 0; k < crlExtensions.size(); k++) { - Extension ext = (Extension) crlExtensions.elementAt(k); + Extension ext = crlExtensions.elementAt(k); if (DeltaCRLIndicatorExtension.OID.equals(ext.getExtensionId().toString())) { DeltaCRLIndicatorExtension dExt = (DeltaCRLIndicatorExtension) ext; diff --git a/base/ca/src/com/netscape/ca/CertificateAuthority.java b/base/ca/src/com/netscape/ca/CertificateAuthority.java index 592f1557b..321fd9410 100644 --- a/base/ca/src/com/netscape/ca/CertificateAuthority.java +++ b/base/ca/src/com/netscape/ca/CertificateAuthority.java @@ -809,7 +809,7 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori try { issuingPointClassName = c.getString(PROP_CLASS); issuingPointClass = (Class) Class.forName(issuingPointClassName); - issuingPoint = (CRLIssuingPoint) issuingPointClass.newInstance(); + issuingPoint = issuingPointClass.newInstance(); issuingPoint.init(this, id, c); mCRLIssuePoints.put(id, issuingPoint); } catch (EPropertyNotFound e) { @@ -1506,13 +1506,13 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori Enumeration instances = instc.getSubStoreNames(); while (instances.hasMoreElements()) { - String id = (String) instances.nextElement(); + String id = instances.nextElement(); if (Debug.ON) Debug.trace("registering listener instance: " + id); IConfigStore iConfig = instc.getSubStore(id); String implName = instc.getString(id + "." + PROP_PLUGIN); - ListenerPlugin plugin = (ListenerPlugin) mListenerPlugins.get(implName); + ListenerPlugin plugin = mListenerPlugins.get(implName); if (plugin == null) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_CA_CA_ERROR_LISTENER", implName)); @@ -1618,7 +1618,7 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori private void initRequestQueue() throws EBaseException { mPolicy = new CAPolicy(); - ((CAPolicy) mPolicy).init(this, mConfig.getSubStore(PROP_POLICY)); + mPolicy.init(this, mConfig.getSubStore(PROP_POLICY)); CMS.debug("CA policy inited"); mService = new CAService(this); CMS.debug("CA service inited"); -- cgit