summaryrefslogtreecommitdiffstats
path: root/pki
diff options
context:
space:
mode:
authorAdam Young <ayoung@redhat.com>2011-11-17 12:27:31 -0500
committerAdam Young <ayoung@redhat.com>2011-12-22 16:39:30 -0500
commit6373ddf8fdb15ecd841735910da728e55ad9582a (patch)
treedca05e58ab87470bf91345af46133a096f7707c7 /pki
parentfd669390a16a0bce341df685c990f3159df11d53 (diff)
downloadpki-6373ddf8fdb15ecd841735910da728e55ad9582a.tar.gz
pki-6373ddf8fdb15ecd841735910da728e55ad9582a.tar.xz
pki-6373ddf8fdb15ecd841735910da728e55ad9582a.zip
type safety for certserv.base
more type safety
Diffstat (limited to 'pki')
-rw-r--r--pki/base/ca/src/com/netscape/ca/CertificateAuthority.java38
-rw-r--r--pki/base/common/src/com/netscape/certsrv/base/IAttrSet.java2
-rw-r--r--pki/base/common/src/com/netscape/certsrv/base/ISecurityDomainSessionTable.java2
-rw-r--r--pki/base/common/src/com/netscape/certsrv/base/ISourceConfigStore.java6
-rw-r--r--pki/base/common/src/com/netscape/certsrv/base/MessageFormatter.java2
-rw-r--r--pki/base/common/src/com/netscape/certsrv/base/MetaInfo.java6
-rw-r--r--pki/base/common/src/com/netscape/certsrv/base/Nonces.java12
-rw-r--r--pki/base/common/src/com/netscape/certsrv/base/SessionContext.java4
-rw-r--r--pki/base/common/src/com/netscape/certsrv/common/NameValuePairs.java10
-rw-r--r--pki/base/common/src/com/netscape/certsrv/request/ARequestNotifier.java16
-rw-r--r--pki/base/common/src/com/netscape/certsrv/request/IRequestNotifier.java4
-rw-r--r--pki/base/common/src/com/netscape/cms/policy/constraints/AgentPolicy.java7
-rw-r--r--pki/base/common/src/com/netscape/cms/profile/common/BasicProfile.java60
-rw-r--r--pki/base/common/src/com/netscape/cms/profile/common/EnrollProfile.java4
-rw-r--r--pki/base/common/src/com/netscape/cms/servlet/admin/ACLAdminServlet.java31
-rw-r--r--pki/base/common/src/com/netscape/cms/servlet/admin/AuthAdminServlet.java18
-rw-r--r--pki/base/common/src/com/netscape/cms/servlet/csadmin/LDAPSecurityDomainSessionTable.java4
-rw-r--r--pki/base/common/src/com/netscape/cms/servlet/csadmin/SecurityDomainSessionTable.java16
-rw-r--r--pki/base/common/src/com/netscape/cmscore/base/PropConfigStore.java6
-rw-r--r--pki/base/common/src/com/netscape/cmscore/base/SimpleProperties.java38
-rw-r--r--pki/base/common/src/com/netscape/cmscore/base/SourceConfigStore.java7
-rw-r--r--pki/base/common/src/com/netscape/cmscore/request/RequestRecord.java2
-rw-r--r--pki/base/common/test/com/netscape/cmscore/request/ExtAttrDynMapperTest.java22
-rw-r--r--pki/base/util/src/netscape/security/util/ASN1CharStrConvMap.java29
24 files changed, 174 insertions, 172 deletions
diff --git a/pki/base/ca/src/com/netscape/ca/CertificateAuthority.java b/pki/base/ca/src/com/netscape/ca/CertificateAuthority.java
index a81ae362a..b1bcb680f 100644
--- a/pki/base/ca/src/com/netscape/ca/CertificateAuthority.java
+++ b/pki/base/ca/src/com/netscape/ca/CertificateAuthority.java
@@ -209,7 +209,7 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori
private ResponderID mResponderIDByName = null;
private ResponderID mResponderIDByHash = null;
- protected Hashtable mListenerPlugins = null;
+ protected Hashtable<String, ListenerPlugin> mListenerPlugins = null;
/**
* Internal constants
@@ -355,10 +355,10 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori
if (publisherClass != null) {
try {
- Class pc = Class.forName(publisherClass);
+ @SuppressWarnings("unchecked")
+ Class<ICRLPublisher> pc = (Class<ICRLPublisher>) Class.forName(publisherClass);
- mCRLPublisher = (ICRLPublisher)
- pc.newInstance();
+ mCRLPublisher = pc.newInstance();
mCRLPublisher.init(this, cpStore);
} catch (ClassNotFoundException ee) {
log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_CA_CA_NO_PUBLISHER", ee.toString()));
@@ -457,7 +457,7 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori
return mPNotify.getListener(name);
}
- public Enumeration getRequestListenerNames() {
+ public Enumeration<String> getRequestListenerNames() {
return mNotify.getListenerNames();
}
@@ -522,7 +522,7 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori
* <P>
*/
public void shutdown() {
- Enumeration enums = mCRLIssuePoints.elements();
+ Enumeration<CRLIssuingPoint> enums = mCRLIssuePoints.elements();
while (enums.hasMoreElements()) {
CRLIssuingPoint point = (CRLIssuingPoint)enums.nextElement();
point.shutdown();
@@ -668,7 +668,7 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori
* <P>
* @return security service
*/
- public Enumeration getCRLIssuingPoints() {
+ public Enumeration<CRLIssuingPoint> getCRLIssuingPoints() {
return mCRLIssuePoints.elements();
}
@@ -679,7 +679,8 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori
/**
* Adds CRL issuing point with the given identifier and description.
*/
- public boolean addCRLIssuingPoint(IConfigStore crlSubStore, String id,
+ @SuppressWarnings("unchecked")
+ public boolean addCRLIssuingPoint(IConfigStore crlSubStore, String id,
boolean enable, String description) {
crlSubStore.makeSubStore(id);
IConfigStore c = crlSubStore.getSubStore(id);
@@ -801,12 +802,12 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori
c.putString("extension.FreshestCRL.pointName0", "");
String issuingPointClassName = null;
- Class issuingPointClass = null;
+ Class<CRLIssuingPoint> issuingPointClass = null;
CRLIssuingPoint issuingPoint = null;
try {
issuingPointClassName = c.getString(PROP_CLASS);
- issuingPointClass = Class.forName(issuingPointClassName);
+ issuingPointClass = (Class<CRLIssuingPoint>)Class.forName(issuingPointClassName);
issuingPoint = (CRLIssuingPoint) issuingPointClass.newInstance();
issuingPoint.init(this, id, c);
mCRLIssuePoints.put(id, issuingPoint);
@@ -1476,14 +1477,14 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori
IConfigStore implc = null;
IConfigStore instc = null;
- mListenerPlugins = new Hashtable();
+ mListenerPlugins = new Hashtable<String, ListenerPlugin>();
try {
// Get list of listener implementations
lc = mConfig.getSubStore(PROP_LISTENER_SUBSTORE);
if (lc != null) {
implc = lc.getSubStore(PROP_IMPL);
- Enumeration names = implc.getSubStoreNames();
+ Enumeration<String> names = implc.getSubStoreNames();
while (names.hasMoreElements()) {
String id = (String) names.nextElement();
@@ -1498,7 +1499,7 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori
}
instc = lc.getSubStore(PROP_INSTANCE);
- Enumeration instances = instc.getSubStoreNames();
+ Enumeration<String> instances = instc.getSubStoreNames();
while (instances.hasMoreElements()) {
String id = (String) instances.nextElement();
@@ -1661,7 +1662,8 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori
/**
* initialize CRL
*/
- private void initCRL()
+ @SuppressWarnings("unchecked")
+ private void initCRL()
throws EBaseException {
IConfigStore crlConfig = mConfig.getSubStore(PROP_CRL_SUBSTORE);
@@ -1687,14 +1689,14 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori
"initializing crl issue point " + issuePointId);
IConfigStore issuePointConfig = null;
String issuePointClassName = null;
- Class issuePointClass = null;
+ Class<CRLIssuingPoint> issuePointClass = null;
CRLIssuingPoint issuePoint = null;
try {
issuePointConfig = crlConfig.getSubStore(issuePointId);
issuePointClassName = issuePointConfig.getString(PROP_CLASS);
- issuePointClass = Class.forName(issuePointClassName);
- issuePoint = (CRLIssuingPoint) issuePointClass.newInstance();
+ issuePointClass = (Class<CRLIssuingPoint>) Class.forName(issuePointClassName);
+ issuePoint = issuePointClass.newInstance();
issuePoint.init(this, issuePointId, issuePointConfig);
mCRLIssuePoints.put(issuePointId, issuePoint);
if (mMasterCRLIssuePoint == null &&
@@ -1803,7 +1805,7 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori
// (3) look into database to check the
// certificate's status
- Vector singleResponses = new Vector();
+ Vector<SingleResponse> singleResponses = new Vector<SingleResponse>();
if (statsSub != null) {
statsSub.startTiming("lookup");
}
diff --git a/pki/base/common/src/com/netscape/certsrv/base/IAttrSet.java b/pki/base/common/src/com/netscape/certsrv/base/IAttrSet.java
index 4e8b0205d..28e36da61 100644
--- a/pki/base/common/src/com/netscape/certsrv/base/IAttrSet.java
+++ b/pki/base/common/src/com/netscape/certsrv/base/IAttrSet.java
@@ -68,5 +68,5 @@ public interface IAttrSet extends Serializable {
*
* @return an enumeration of the attribute names.
*/
- public Enumeration getElements();
+ public Enumeration<?> getElements();
}
diff --git a/pki/base/common/src/com/netscape/certsrv/base/ISecurityDomainSessionTable.java b/pki/base/common/src/com/netscape/certsrv/base/ISecurityDomainSessionTable.java
index 3902d4433..ced3886cb 100644
--- a/pki/base/common/src/com/netscape/certsrv/base/ISecurityDomainSessionTable.java
+++ b/pki/base/common/src/com/netscape/certsrv/base/ISecurityDomainSessionTable.java
@@ -35,5 +35,5 @@ public interface ISecurityDomainSessionTable {
public long getBeginTime(String sessionId);
public int getSize();
public long getTimeToLive();
- public Enumeration getSessionIds();
+ public Enumeration<String> getSessionIds();
}
diff --git a/pki/base/common/src/com/netscape/certsrv/base/ISourceConfigStore.java b/pki/base/common/src/com/netscape/certsrv/base/ISourceConfigStore.java
index fb8628ba2..03adb7009 100644
--- a/pki/base/common/src/com/netscape/certsrv/base/ISourceConfigStore.java
+++ b/pki/base/common/src/com/netscape/certsrv/base/ISourceConfigStore.java
@@ -42,7 +42,7 @@ public interface ISourceConfigStore extends Serializable {
* @param name The property name
* @return property value
*/
- public Object get(String name);
+ public String get(String name);
/**
* Retrieves a property.
@@ -51,7 +51,7 @@ public interface ISourceConfigStore extends Serializable {
* @param name The property name
* @param value The property value
*/
- public void put(String name, Object value);
+ public String put(String name, String value);
/**
* Returns an enumeration of the config store's keys.
@@ -61,7 +61,7 @@ public interface ISourceConfigStore extends Serializable {
* @see java.util.Hashtable#elements
* @see java.util.Enumeration
*/
- public Enumeration keys();
+ public Enumeration<String> keys();
/**
* Reads a config store from an input stream.
diff --git a/pki/base/common/src/com/netscape/certsrv/base/MessageFormatter.java b/pki/base/common/src/com/netscape/certsrv/base/MessageFormatter.java
index 16324fb91..8e186fc48 100644
--- a/pki/base/common/src/com/netscape/certsrv/base/MessageFormatter.java
+++ b/pki/base/common/src/com/netscape/certsrv/base/MessageFormatter.java
@@ -38,7 +38,7 @@ import java.util.ResourceBundle;
*/
public class MessageFormatter {
- private static final Class[] toStringSignature = { Locale.class };
+ private static final Class<?>[] toStringSignature = { Locale.class };
/**
* Retrieves the localized string.
diff --git a/pki/base/common/src/com/netscape/certsrv/base/MetaInfo.java b/pki/base/common/src/com/netscape/certsrv/base/MetaInfo.java
index 1922e74c6..65e401743 100644
--- a/pki/base/common/src/com/netscape/certsrv/base/MetaInfo.java
+++ b/pki/base/common/src/com/netscape/certsrv/base/MetaInfo.java
@@ -39,7 +39,7 @@ public class MetaInfo implements IAttrSet {
public static final String REQUEST_ID = "requestId";
public static final String IN_LDAP_PUBLISH_DIR = "inLdapPublishDir";
- private Hashtable content = new Hashtable();
+ private Hashtable<String, Object> content = new Hashtable<String, Object>();
/**
* Constructs a meta information.
@@ -59,7 +59,7 @@ public class MetaInfo implements IAttrSet {
sb.append("[\n");
sb.append(" Meta information:\n");
- Enumeration enum1 = content.keys();
+ Enumeration<String> enum1 = content.keys();
while (enum1.hasMoreElements()) {
String key = (String) enum1.nextElement();
@@ -111,7 +111,7 @@ public class MetaInfo implements IAttrSet {
*
* @return an enumeration of the attribute names.
*/
- public Enumeration getElements() {
+ public Enumeration<String> getElements() {
return content.keys();
}
}
diff --git a/pki/base/common/src/com/netscape/certsrv/base/Nonces.java b/pki/base/common/src/com/netscape/certsrv/base/Nonces.java
index 470ba654c..fde209332 100644
--- a/pki/base/common/src/com/netscape/certsrv/base/Nonces.java
+++ b/pki/base/common/src/com/netscape/certsrv/base/Nonces.java
@@ -28,25 +28,21 @@ import java.util.Vector;
*
* @version $Revision$, $Date$
*/
-public class Nonces implements IAuthInfo {
+public class Nonces {
- private Hashtable mNonces = new Hashtable();
- private Vector mNonceList = new Vector();
+ private Hashtable<Long, X509Certificate> mNonces = new Hashtable<Long, X509Certificate>();
+ private Vector<Long> mNonceList = new Vector<Long>();
private int mNonceLimit;
/**
* Constructs nonces.
*/
public Nonces() {
- mNonceLimit = 100;
- Vector mNonceList = new Vector();
- Hashtable mNonces = new Hashtable();
+ this(100);
}
public Nonces(int limit) {
mNonceLimit = limit;
- Vector mNonceList = new Vector();
- Hashtable mNonces = new Hashtable();
}
public long addNonce(long nonce, X509Certificate cert) {
diff --git a/pki/base/common/src/com/netscape/certsrv/base/SessionContext.java b/pki/base/common/src/com/netscape/certsrv/base/SessionContext.java
index 29c390acd..151c24205 100644
--- a/pki/base/common/src/com/netscape/certsrv/base/SessionContext.java
+++ b/pki/base/common/src/com/netscape/certsrv/base/SessionContext.java
@@ -32,7 +32,7 @@ import java.util.Hashtable;
*
* @version $Revision$, $Date$
*/
-public class SessionContext extends Hashtable implements IAuthInfo {
+public class SessionContext extends Hashtable<Object,Object> {
/**
*
@@ -84,7 +84,7 @@ public class SessionContext extends Hashtable implements IAuthInfo {
*/
public static final String IPADDRESS = "ipAddress";
- private static Hashtable mContexts = new Hashtable();
+ private static Hashtable<Thread, SessionContext> mContexts = new Hashtable<Thread, SessionContext>();
/**
* Constructs a session context.
diff --git a/pki/base/common/src/com/netscape/certsrv/common/NameValuePairs.java b/pki/base/common/src/com/netscape/certsrv/common/NameValuePairs.java
index 678ccfee2..651de7820 100644
--- a/pki/base/common/src/com/netscape/certsrv/common/NameValuePairs.java
+++ b/pki/base/common/src/com/netscape/certsrv/common/NameValuePairs.java
@@ -32,11 +32,11 @@ import java.util.Vector;
*/
public class NameValuePairs {
- private Vector mPairs = new Vector();
+ private Vector<NameValuePair> mPairs = new Vector<NameValuePair>();
// an index to speed up searching
// The key is the name. The element is the NameValuePair.
- private Hashtable index = new Hashtable();
+ private Hashtable<String, NameValuePair> index = new Hashtable<String, NameValuePair>();
/**
* Constructs name value pairs.
@@ -122,8 +122,8 @@ public class NameValuePairs {
*
* @return a list of names
*/
- public Enumeration getNames() {
- Vector v = new Vector();
+ public Enumeration<String> getNames() {
+ Vector<String> v = new Vector<String>();
int size = mPairs.size();
for (int i = 0; i < size; i++) {
@@ -183,7 +183,7 @@ public class NameValuePairs {
*
* @return name value objects
*/
- public Enumeration elements() {
+ public Enumeration<NameValuePair> elements() {
return mPairs.elements();
}
}
diff --git a/pki/base/common/src/com/netscape/certsrv/request/ARequestNotifier.java b/pki/base/common/src/com/netscape/certsrv/request/ARequestNotifier.java
index 3d3274869..65ddeac96 100644
--- a/pki/base/common/src/com/netscape/certsrv/request/ARequestNotifier.java
+++ b/pki/base/common/src/com/netscape/certsrv/request/ARequestNotifier.java
@@ -37,9 +37,9 @@ import com.netscape.certsrv.publish.IPublisherProcessor;
* @version $Revision$, $Date$
*/
public class ARequestNotifier implements IRequestNotifier {
- private Hashtable mListeners = new Hashtable();
- private Vector mNotifierThreads = new Vector();
- private Vector mRequests = new Vector();
+ private Hashtable<String, IRequestListener> mListeners = new Hashtable<String, IRequestListener>();
+ private Vector<Thread> mNotifierThreads = new Vector<Thread>();
+ private Vector<String> mRequests = new Vector<String>();
private int mMaxRequests = 100;
private boolean mSearchForRequests = false;
private int mMaxThreads = 1;
@@ -141,7 +141,7 @@ public class ARequestNotifier implements IRequestNotifier {
*
* @return enumeration of listener names
*/
- public Enumeration getListenerNames() {
+ public Enumeration<String> getListenerNames() {
return mListeners.keys();
}
@@ -169,7 +169,7 @@ public class ARequestNotifier implements IRequestNotifier {
*
* @return enumeration of listeners
*/
- public Enumeration getListeners() {
+ public Enumeration<IRequestListener> getListeners() {
return mListeners.elements();
}
@@ -327,7 +327,7 @@ public class ARequestNotifier implements IRequestNotifier {
if (mIsPublishingQueueEnabled) {
addToNotify(r);
} else if (mMaxThreads == 0) {
- Enumeration listeners = mListeners.elements();
+ Enumeration<IRequestListener> listeners = mListeners.elements();
if (listeners != null && r != null) {
while (listeners.hasMoreElements()) {
IRequestListener l = (IRequestListener) listeners.nextElement();
@@ -485,7 +485,7 @@ public class ARequestNotifier implements IRequestNotifier {
*/
class RunListeners implements Runnable {
IRequest mRequest = null;
- Enumeration mListeners = null;
+ Enumeration<IRequestListener> mListeners = null;
IRequestNotifier mRequestNotifier = null;
/**
@@ -494,7 +494,7 @@ class RunListeners implements Runnable {
* @param r request
* @param listeners list of listeners
*/
- public RunListeners(IRequest r, Enumeration listeners) {
+ public RunListeners(IRequest r, Enumeration<IRequestListener> listeners) {
mRequest = r;
mListeners = listeners;
}
diff --git a/pki/base/common/src/com/netscape/certsrv/request/IRequestNotifier.java b/pki/base/common/src/com/netscape/certsrv/request/IRequestNotifier.java
index 01527b672..ba06c6267 100644
--- a/pki/base/common/src/com/netscape/certsrv/request/IRequestNotifier.java
+++ b/pki/base/common/src/com/netscape/certsrv/request/IRequestNotifier.java
@@ -62,7 +62,7 @@ public interface IRequestNotifier extends INotify {
*
* @return enumeration of listener names
*/
- public Enumeration getListenerNames();
+ public Enumeration<String> getListenerNames();
/**
* Gets listener from the list of registered listeners.
@@ -77,7 +77,7 @@ public interface IRequestNotifier extends INotify {
*
* @return enumeration of listeners
*/
- public Enumeration getListeners();
+ public Enumeration<IRequestListener> getListeners();
/**
* Gets request from publishing queue.
diff --git a/pki/base/common/src/com/netscape/cms/policy/constraints/AgentPolicy.java b/pki/base/common/src/com/netscape/cms/policy/constraints/AgentPolicy.java
index 2a98f12fd..3aeadabe5 100644
--- a/pki/base/common/src/com/netscape/cms/policy/constraints/AgentPolicy.java
+++ b/pki/base/common/src/com/netscape/cms/policy/constraints/AgentPolicy.java
@@ -78,7 +78,8 @@ public class AgentPolicy extends APolicyRule
IConfigStore substore = config.getSubStore("params");
try {
- Class c = Class.forName(className);
+ @SuppressWarnings("unchecked")
+ Class<APolicyRule> c = (Class<APolicyRule>) Class.forName(className);
Object o = c.newInstance();
@@ -146,7 +147,7 @@ public class AgentPolicy extends APolicyRule
*
* @return nvPairs A Vector of name/value pairs.
*/
- public Vector getInstanceParams() {
+ public Vector<String> getInstanceParams() {
return null;
}
@@ -155,7 +156,7 @@ public class AgentPolicy extends APolicyRule
*
* @return nvPairs A Vector of name/value pairs.
*/
- public Vector getDefaultParams() {
+ public Vector<String> getDefaultParams() {
return null;
}
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 acaf9772a..68c706f5f 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
@@ -83,19 +83,19 @@ public abstract class BasicProfile implements IProfile {
protected IConfigStore mConfig = null;
protected IPluginRegistry mRegistry = null;
- protected Vector mInputNames = new Vector();
- protected Hashtable mInputs = new Hashtable();
- protected Vector mInputIds = new Vector();
- protected Hashtable mOutputs = new Hashtable();
- protected Vector mOutputIds = new Vector();
- protected Hashtable mUpdaters = new Hashtable();
- protected Vector mUpdaterIds = new Vector();
+ protected Vector<String> mInputNames = new Vector<String>();
+ protected Hashtable<String, IProfileInput> mInputs = new Hashtable<String, IProfileInput>();
+ protected Vector<String> mInputIds = new Vector<String>();
+ protected Hashtable<String, IProfileOutput> mOutputs = new Hashtable<String, IProfileOutput>();
+ protected Vector<String> mOutputIds = new Vector<String>();
+ protected Hashtable<String, IProfileUpdater> mUpdaters = new Hashtable<String, IProfileUpdater>();
+ protected Vector<String> mUpdaterIds = new Vector<String>();
protected IProfileAuthenticator mAuthenticator = null;
protected String mAuthInstanceId = null;
protected String mId = null;
protected String mAuthzAcl = "";
- protected Hashtable mPolicySet = new Hashtable();
+ protected Hashtable<String, Vector<ProfilePolicy>> mPolicySet = new Hashtable<String, Vector<ProfilePolicy>>();
protected ILogger mSignedAuditLogger = CMS.getSignedAuditLogger();
@@ -343,11 +343,11 @@ public abstract class BasicProfile implements IProfile {
return mConfig;
}
- public Enumeration getInputNames() {
+ public Enumeration<String> getInputNames() {
return mInputNames.elements();
}
- public Enumeration getProfileUpdaterIds() {
+ public Enumeration<String> getProfileUpdaterIds() {
return mUpdaterIds.elements(); // ordered list
}
@@ -355,7 +355,7 @@ public abstract class BasicProfile implements IProfile {
return (IProfileUpdater) mUpdaters.get(name);
}
- public Enumeration getProfileOutputIds() {
+ public Enumeration<String> getProfileOutputIds() {
return mOutputIds.elements(); // ordered list
}
@@ -363,7 +363,7 @@ public abstract class BasicProfile implements IProfile {
return (IProfileOutput) mOutputs.get(name);
}
- public Enumeration getProfileInputIds() {
+ public Enumeration<String> getProfileInputIds() {
return mInputIds.elements(); // ordered list
}
@@ -388,13 +388,13 @@ public abstract class BasicProfile implements IProfile {
String value) throws EProfileException {
}
- public Enumeration getProfilePolicySetIds() {
+ public Enumeration<String> getProfilePolicySetIds() {
return mPolicySet.keys();
}
public void deleteProfilePolicy(String setId, String policyId)
throws EProfileException {
- Vector policies = (Vector) mPolicySet.get(setId);
+ Vector<ProfilePolicy> policies = mPolicySet.get(setId);
if (policies == null) {
return;
@@ -621,7 +621,7 @@ public abstract class BasicProfile implements IProfile {
outputInfo.getName(Locale.getDefault()));
outputStore.putString(prefix + "class_id", outputId);
- Enumeration enum1 = nvps.getNames();
+ Enumeration<String> enum1 = nvps.getNames();
while (enum1.hasMoreElements()) {
String name = (String) enum1.nextElement();
@@ -724,7 +724,7 @@ public abstract class BasicProfile implements IProfile {
inputInfo.getName(Locale.getDefault()));
inputStore.putString(prefix + "class_id", inputId);
- Enumeration enum1 = nvps.getNames();
+ Enumeration<String> enum1 = nvps.getNames();
while (enum1.hasMoreElements()) {
String name = (String) enum1.nextElement();
@@ -772,16 +772,16 @@ public abstract class BasicProfile implements IProfile {
// String constraintClassId : if of the constraint plugin ex: basicConstraintsExtConstraintImpl
// boolean createConfig : true : being called from the console. false: being called from server startup code
- Vector policies = (Vector) mPolicySet.get(setId);
+ Vector<ProfilePolicy> policies = mPolicySet.get(setId);
IConfigStore policyStore = mConfig.getSubStore("policyset." + setId);
if (policies == null) {
- policies = new Vector();
+ policies = new Vector<ProfilePolicy>();
mPolicySet.put(setId, policies);
if (createConfig) {
// re-create policyset.list
StringBuffer setlist =new StringBuffer();
- Enumeration keys = mPolicySet.keys();
+ Enumeration<String> keys = mPolicySet.keys();
while (keys.hasMoreElements()) {
String k = (String) keys.nextElement();
@@ -990,7 +990,7 @@ public abstract class BasicProfile implements IProfile {
}
public IProfilePolicy getProfilePolicy(String setId, String id) {
- Vector policies = (Vector) mPolicySet.get(setId);
+ Vector<ProfilePolicy> policies = mPolicySet.get(setId);
if (policies == null)
return null;
@@ -1057,7 +1057,7 @@ public abstract class BasicProfile implements IProfile {
public void populateInput(IProfileContext ctx, IRequest request)
throws EProfileException {
- Enumeration ids = getProfileInputIds();
+ Enumeration<String> ids = getProfileInputIds();
while (ids.hasMoreElements()) {
String id = (String) ids.nextElement();
@@ -1067,8 +1067,8 @@ public abstract class BasicProfile implements IProfile {
}
}
- public Vector getPolicies(String setId) {
- Vector policies = (Vector) mPolicySet.get(setId);
+ public Vector<ProfilePolicy> getPolicies(String setId) {
+ Vector<ProfilePolicy> policies = mPolicySet.get(setId);
return policies;
}
@@ -1080,7 +1080,7 @@ public abstract class BasicProfile implements IProfile {
public void populate(IRequest request)
throws EProfileException {
String setId = getPolicySetId(request);
- Vector policies = getPolicies(setId);
+ Vector<ProfilePolicy> policies = getPolicies(setId);
CMS.debug("BasicProfile: populate() policy setid ="+ setId);
for (int i = 0; i < policies.size(); i++) {
@@ -1099,7 +1099,7 @@ public abstract class BasicProfile implements IProfile {
throws ERejectException {
String setId = getPolicySetId(request);
CMS.debug("BasicProfile: validate start on setId="+ setId);
- Vector policies = getPolicies(setId);
+ Vector<ProfilePolicy> policies = getPolicies(setId);
for (int i = 0; i < policies.size(); i++) {
ProfilePolicy policy = (ProfilePolicy)
@@ -1112,21 +1112,21 @@ public abstract class BasicProfile implements IProfile {
CMS.debug("BasicProfile: validate end");
}
- public Enumeration getProfilePolicies(String setId) {
- Vector policies = (Vector) mPolicySet.get(setId);
+ public Enumeration<ProfilePolicy> getProfilePolicies(String setId) {
+ Vector<ProfilePolicy> policies = mPolicySet.get(setId);
if (policies == null)
return null;
return policies.elements();
}
- public Enumeration getProfilePolicyIds(String setId) {
- Vector policies = (Vector) mPolicySet.get(setId);
+ public Enumeration<String> getProfilePolicyIds(String setId) {
+ Vector<ProfilePolicy> policies = mPolicySet.get(setId);
if (policies == null)
return null;
- Vector v = new Vector();
+ Vector<String> v = new Vector<String>();
for (int i = 0; i < policies.size(); i++) {
ProfilePolicy policy = (ProfilePolicy)
diff --git a/pki/base/common/src/com/netscape/cms/profile/common/EnrollProfile.java b/pki/base/common/src/com/netscape/cms/profile/common/EnrollProfile.java
index 95c360f8c..8bc6f1903 100644
--- a/pki/base/common/src/com/netscape/cms/profile/common/EnrollProfile.java
+++ b/pki/base/common/src/com/netscape/cms/profile/common/EnrollProfile.java
@@ -28,7 +28,6 @@ import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.util.Date;
import java.util.Enumeration;
-import java.util.Hashtable;
import java.util.Locale;
import java.util.StringTokenizer;
@@ -281,7 +280,7 @@ public abstract class EnrollProfile extends BasicProfile
int seq_no = seq.intValue(); // start from 0
int count = 0;
- Enumeration setIds = getProfilePolicySetIds();
+ Enumeration<String> setIds = getProfilePolicySetIds();
while (setIds.hasMoreElements()) {
String setId = (String) setIds.nextElement();
@@ -369,7 +368,6 @@ public abstract class EnrollProfile extends BasicProfile
}
CMS.debug("EnrollProfile: Start parseCMC(): " + certreq);
- Hashtable t1 = new Hashtable();
TaggedRequest msgs[] = null;
String creq = normalizeCertReq(certreq);
diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/ACLAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/ACLAdminServlet.java
index c4fa440d1..4737e2f77 100644
--- a/pki/base/common/src/com/netscape/cms/servlet/admin/ACLAdminServlet.java
+++ b/pki/base/common/src/com/netscape/cms/servlet/admin/ACLAdminServlet.java
@@ -254,7 +254,7 @@ public class ACLAdminServlet extends AdminServlet {
NameValuePairs params = new NameValuePairs();
- Enumeration res = mAuthzMgr.getACLs();
+ Enumeration<ACL> res = mAuthzMgr.getACLs();
while (res.hasMoreElements()) {
ACL acl = (ACL) res.nextElement();
@@ -291,16 +291,16 @@ public class ACLAdminServlet extends AdminServlet {
IACL acl = mAuthzMgr.getACL(resourceId);
if (acl != null) {
- Enumeration en = acl.rights();
+ Enumeration<String> rightsEnum = acl.rights();
StringBuffer rights = new StringBuffer();
- if (en.hasMoreElements()) {
- while (en.hasMoreElements()) {
+ if (rightsEnum.hasMoreElements()) {
+ while (rightsEnum.hasMoreElements()) {
if (rights.length() != 0) {
rights.append(",");
}
- String right = (String) en.nextElement();
+ String right = rightsEnum.nextElement();
rights.append(right);
}
@@ -308,15 +308,16 @@ public class ACLAdminServlet extends AdminServlet {
params.add(Constants.PR_ACL_OPS, rights.toString());
- en = acl.entries();
+ Enumeration<ACLEntry> aclEntryEnum;
+ aclEntryEnum = acl.entries();
String acis = "";
- if (en.hasMoreElements()) {
- while (en.hasMoreElements()) {
+ if (aclEntryEnum.hasMoreElements()) {
+ while (aclEntryEnum.hasMoreElements()) {
if (acis != "") {
acis += ";";
}
- ACLEntry aclEntry = (ACLEntry) en.nextElement();
+ ACLEntry aclEntry = (ACLEntry) aclEntryEnum.nextElement();
String aci = aclEntry.getACLEntryString();
acis += aci;
@@ -466,10 +467,10 @@ public class ACLAdminServlet extends AdminServlet {
HttpServletResponse resp) throws ServletException, IOException,
EBaseException {
NameValuePairs params = new NameValuePairs();
- Enumeration res = mAuthzMgr.aclEvaluatorElements();
+ Enumeration<IAccessEvaluator> res = mAuthzMgr.aclEvaluatorElements();
while (res.hasMoreElements()) {
- IAccessEvaluator evaluator = (IAccessEvaluator) res.nextElement();
+ IAccessEvaluator evaluator = res.nextElement();
// params.add(evaluator.getType(), evaluator.getDescription());
params.add(evaluator.getType(), evaluator.getClass().getName());
@@ -482,10 +483,10 @@ public class ACLAdminServlet extends AdminServlet {
HttpServletResponse resp) throws ServletException, IOException,
EBaseException {
NameValuePairs params = new NameValuePairs();
- Enumeration res = mAuthzMgr.aclEvaluatorElements();
+ Enumeration<IAccessEvaluator> res = mAuthzMgr.aclEvaluatorElements();
while (res.hasMoreElements()) {
- IAccessEvaluator evaluator = (IAccessEvaluator) res.nextElement();
+ IAccessEvaluator evaluator = res.nextElement();
String[] operators = evaluator.getSupportedOperators();
StringBuffer str = new StringBuffer();
@@ -564,7 +565,7 @@ public class ACLAdminServlet extends AdminServlet {
destStore.getSubStore(ScopeDef.SC_ACL_IMPLS);
// Does the class exist?
- Class newImpl = null;
+ Class<?> newImpl = null;
try {
newImpl = Class.forName(classPath);
@@ -787,7 +788,7 @@ public class ACLAdminServlet extends AdminServlet {
}
// does the evaluator exist?
- Hashtable mEvaluators = mAuthzMgr.getAccessEvaluators();
+ Hashtable<String, IAccessEvaluator> mEvaluators = mAuthzMgr.getAccessEvaluators();
if (mEvaluators.containsKey(id) == false) {
log(ILogger.LL_FAILURE, "evaluator attempted to be removed not found");
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 ff9b99115..4a7329c96 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
@@ -369,7 +369,8 @@ public class AuthAdminServlet extends AdminServlet {
* @exception IOException an input/output error has occurred
* @exception EBaseException an error has occurred
*/
- private synchronized void addAuthMgrPlugin(HttpServletRequest req,
+
+ private synchronized void addAuthMgrPlugin(HttpServletRequest req,
HttpServletResponse resp, String scope)
throws ServletException, IOException, EBaseException {
@@ -454,10 +455,13 @@ public class AuthAdminServlet extends AdminServlet {
destStore.getSubStore(scope);
// Does the class exist?
- Class newImpl = null;
+
+ Class<IAuthManager> newImpl = null;
try {
- newImpl = Class.forName(classPath);
+ @SuppressWarnings("unchecked")
+ Class<IAuthManager> tmpImpl = (Class<IAuthManager>) Class.forName(classPath);
+ newImpl = tmpImpl;
} catch (ClassNotFoundException e) {
// store a message in the signed audit log file
auditMessage = CMS.getLogMessage(
@@ -901,7 +905,7 @@ public class AuthAdminServlet extends AdminServlet {
IOException, EBaseException {
NameValuePairs params = new NameValuePairs();
- Enumeration e = mAuths.getPlugins().keys();
+ Enumeration<String> e = mAuths.getPlugins().keys();
while (e.hasMoreElements()) {
String name = (String) e.nextElement();
@@ -922,7 +926,7 @@ public class AuthAdminServlet extends AdminServlet {
NameValuePairs params = new NameValuePairs();
- for (Enumeration e = mAuths.getInstances().keys();
+ for (Enumeration<?> e = mAuths.getInstances().keys();
e.hasMoreElements();) {
String name = (String) e.nextElement();
AuthManagerProxy proxy = (AuthManagerProxy) mAuths.getInstances().get(name);
@@ -1018,7 +1022,7 @@ public class AuthAdminServlet extends AdminServlet {
// first check if any instances from this auth manager
// DON'T remove auth manager if any instance
- for (Enumeration e = mAuths.getInstances().keys();
+ for (Enumeration<?> e = mAuths.getInstances().keys();
e.hasMoreElements();) {
IAuthManager authMgr = (IAuthManager) mAuths.get((String) e.nextElement());
@@ -1689,7 +1693,7 @@ public class AuthAdminServlet extends AdminServlet {
store.removeSubStore(id);
IConfigStore rstore = store.makeSubStore(id);
- Enumeration keys = saveParams.getNames();
+ Enumeration<String> keys = saveParams.getNames();
while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/LDAPSecurityDomainSessionTable.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/LDAPSecurityDomainSessionTable.java
index da2a3ccbd..a421302b1 100644
--- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/LDAPSecurityDomainSessionTable.java
+++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/LDAPSecurityDomainSessionTable.java
@@ -169,10 +169,10 @@ public class LDAPSecurityDomainSessionTable
}
- public Enumeration getSessionIds() {
+ public Enumeration<String> getSessionIds() {
IConfigStore cs = CMS.getConfigStore();
LDAPConnection conn = null;
- Vector ret = new Vector();
+ Vector<String> ret = new Vector<String>();
try {
String basedn = cs.getString("internaldb.basedn");
diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/SecurityDomainSessionTable.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/SecurityDomainSessionTable.java
index 3d3530f2e..75cc0fb60 100644
--- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/SecurityDomainSessionTable.java
+++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/SecurityDomainSessionTable.java
@@ -30,17 +30,17 @@ import com.netscape.certsrv.base.ISecurityDomainSessionTable;
public class SecurityDomainSessionTable
implements ISecurityDomainSessionTable {
- private Hashtable m_sessions;
+ private Hashtable<String, Vector<Comparable<?>>> m_sessions;
private long m_timeToLive;
public SecurityDomainSessionTable(long timeToLive) {
- m_sessions = new Hashtable();
+ m_sessions = new Hashtable<String, Vector<Comparable<?>>>();
m_timeToLive = timeToLive;
}
public int addEntry(String sessionId, String ip,
String uid, String group) {
- Vector v = new Vector();
+ Vector<Comparable<?>> v = new Vector<Comparable<?>>();
v.addElement(ip);
v.addElement(uid);
v.addElement(group);
@@ -60,33 +60,33 @@ public class SecurityDomainSessionTable
return m_sessions.containsKey(sessionId);
}
- public Enumeration getSessionIds() {
+ public Enumeration<String> getSessionIds() {
return m_sessions.keys();
}
public String getIP(String sessionId) {
- Vector v = (Vector)m_sessions.get(sessionId);
+ Vector<Comparable<?>> v = m_sessions.get(sessionId);
if (v != null)
return (String)v.elementAt(0);
return null;
}
public String getUID(String sessionId) {
- Vector v = (Vector)m_sessions.get(sessionId);
+ Vector<Comparable<?>> v = m_sessions.get(sessionId);
if (v != null)
return (String)v.elementAt(1);
return null;
}
public String getGroup(String sessionId) {
- Vector v = (Vector)m_sessions.get(sessionId);
+ Vector<Comparable<?>> v = m_sessions.get(sessionId);
if (v != null)
return (String)v.elementAt(2);
return null;
}
public long getBeginTime(String sessionId) {
- Vector v = (Vector)m_sessions.get(sessionId);
+ Vector<Comparable<?>> v = m_sessions.get(sessionId);
if (v != null) {
Long n = (Long)v.elementAt(3);
if (n != 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 e54b19d90..be8e70078 100644
--- a/pki/base/common/src/com/netscape/cmscore/base/PropConfigStore.java
+++ b/pki/base/common/src/com/netscape/cmscore/base/PropConfigStore.java
@@ -125,7 +125,7 @@ public class PropConfigStore implements IConfigStore, Cloneable {
* @param name property name
* @return property value
*/
- public Object get(String name) {
+ public String get(String name) {
return mSource.get(getFullName(name));
}
@@ -150,8 +150,8 @@ public class PropConfigStore implements IConfigStore, Cloneable {
* @param name property name
* @param value property value
*/
- public void put(String name, Object value) {
- mSource.put(getFullName(name), value);
+ public String put(String name, String value) {
+ return mSource.put(getFullName(name), value);
}
/**
diff --git a/pki/base/common/src/com/netscape/cmscore/base/SimpleProperties.java b/pki/base/common/src/com/netscape/cmscore/base/SimpleProperties.java
index 924248d01..4eb1c839a 100644
--- a/pki/base/common/src/com/netscape/cmscore/base/SimpleProperties.java
+++ b/pki/base/common/src/com/netscape/cmscore/base/SimpleProperties.java
@@ -52,7 +52,7 @@ import java.util.Hashtable;
* non-<code>String</code> key or value, the call will fail.
*
*/
-public class SimpleProperties extends Hashtable {
+public class SimpleProperties extends Hashtable<String,String> {
/**
*
@@ -340,9 +340,9 @@ public class SimpleProperties extends Hashtable {
if (header != null)
writeln(awriter, "#" + header);
writeln(awriter, "#" + new Date().toString());
- for (Enumeration e = keys(); e.hasMoreElements();) {
- String key = (String) e.nextElement();
- String val = (String) get(key);
+ for (Enumeration<String> e = keys(); e.hasMoreElements();) {
+ String key = e.nextElement();
+ String val = get(key);
// key = saveConvert(key);
// val = saveConvert(val);
@@ -367,8 +367,8 @@ public class SimpleProperties extends Hashtable {
* @see java.util.Properties#defaults
*/
public String getProperty(String key) {
- Object oval = super.get(key);
- String sval = (oval instanceof String) ? (String) oval : null;
+ String oval = super.get(key);
+ String sval = (oval instanceof String) ? oval : null;
return ((sval == null) && (defaults != null)) ? defaults.getProperty(key) : sval;
}
@@ -400,8 +400,8 @@ public class SimpleProperties extends Hashtable {
* @see java.util.Enumeration
* @see java.util.Properties#defaults
*/
- public Enumeration propertyNames() {
- Hashtable h = new Hashtable();
+ public Enumeration<String> propertyNames() {
+ Hashtable<String, String> h = new Hashtable<String, String>();
enumerate(h);
return h.keys();
@@ -415,12 +415,12 @@ public class SimpleProperties extends Hashtable {
*/
public void list(PrintStream out) {
out.println("-- listing properties --");
- Hashtable h = new Hashtable();
+ Hashtable<String, String> h = new Hashtable<String, String>();
enumerate(h);
- for (Enumeration e = h.keys(); e.hasMoreElements();) {
- String key = (String) e.nextElement();
- String val = (String) h.get(key);
+ for (Enumeration<String> e = h.keys(); e.hasMoreElements();) {
+ String key = e.nextElement();
+ String val = h.get(key);
if (val.length() > 40) {
val = val.substring(0, 37) + "...";
@@ -444,12 +444,12 @@ public class SimpleProperties extends Hashtable {
*/
public void list(PrintWriter out) {
out.println("-- listing properties --");
- Hashtable h = new Hashtable();
+ Hashtable<String, String> h = new Hashtable<String, String>();
enumerate(h);
- for (Enumeration e = h.keys(); e.hasMoreElements();) {
- String key = (String) e.nextElement();
- String val = (String) h.get(key);
+ for (Enumeration<String> e = h.keys(); e.hasMoreElements();) {
+ String key = e.nextElement();
+ String val = h.get(key);
if (val.length() > 40) {
val = val.substring(0, 37) + "...";
@@ -462,12 +462,12 @@ public class SimpleProperties extends Hashtable {
* Enumerates all key/value pairs in the specified hastable.
* @param h the hashtable
*/
- private synchronized void enumerate(Hashtable h) {
+ private synchronized void enumerate(Hashtable<String, String> h) {
if (defaults != null) {
defaults.enumerate(h);
}
- for (Enumeration e = keys(); e.hasMoreElements();) {
- String key = (String) e.nextElement();
+ for (Enumeration<String> e = keys(); e.hasMoreElements();) {
+ String key = e.nextElement();
h.put(key, get(key));
}
diff --git a/pki/base/common/src/com/netscape/cmscore/base/SourceConfigStore.java b/pki/base/common/src/com/netscape/cmscore/base/SourceConfigStore.java
index 2b472c029..70af37cee 100644
--- a/pki/base/common/src/com/netscape/cmscore/base/SourceConfigStore.java
+++ b/pki/base/common/src/com/netscape/cmscore/base/SourceConfigStore.java
@@ -43,7 +43,7 @@ public class SourceConfigStore extends SimpleProperties implements ISourceConfig
* @param name property name
* @return property value
*/
- public Object get(String name) {
+ public String get(String name) {
return super.get(name); // from Properties->Hashtable
}
@@ -53,8 +53,9 @@ public class SourceConfigStore extends SimpleProperties implements ISourceConfig
*
* @param name property name
* @param value property value
+ * @return
*/
- public void put(String name, Object value) {
- super.put(name, value); // from Properties->Hashtable
+ public String put(String name, String value) {
+ return super.put(name, value); // from Properties->Hashtable
}
}
diff --git a/pki/base/common/src/com/netscape/cmscore/request/RequestRecord.java b/pki/base/common/src/com/netscape/cmscore/request/RequestRecord.java
index 76863ca9a..99764b911 100644
--- a/pki/base/common/src/com/netscape/cmscore/request/RequestRecord.java
+++ b/pki/base/common/src/com/netscape/cmscore/request/RequestRecord.java
@@ -631,7 +631,7 @@ class ExtAttrDynMapper implements IDBDynAttrMapper {
attrName.toLowerCase().startsWith(extAttrPrefix);
}
- public Enumeration getSupportedLDAPAttributeNames() {
+ public Enumeration<String> getSupportedLDAPAttributeNames() {
return mAttrs.elements();
}
diff --git a/pki/base/common/test/com/netscape/cmscore/request/ExtAttrDynMapperTest.java b/pki/base/common/test/com/netscape/cmscore/request/ExtAttrDynMapperTest.java
index 2a9a2ef00..f47cbe0ae 100644
--- a/pki/base/common/test/com/netscape/cmscore/request/ExtAttrDynMapperTest.java
+++ b/pki/base/common/test/com/netscape/cmscore/request/ExtAttrDynMapperTest.java
@@ -1,5 +1,6 @@
package com.netscape.cmscore.request;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
@@ -55,8 +56,8 @@ public class ExtAttrDynMapperTest extends CMSBaseTestCase {
}
public void testGetSupportedLdapAttributesNames() {
- Enumeration attrs = mapper.getSupportedLDAPAttributeNames();
- ArrayList attrsList = new ArrayList();
+ Enumeration<String> attrs = mapper.getSupportedLDAPAttributeNames();
+ ArrayList<String> attrsList = new ArrayList<String>();
while (attrs.hasMoreElements()) {
attrsList.add(attrs.nextElement());
}
@@ -117,7 +118,7 @@ public class ExtAttrDynMapperTest extends CMSBaseTestCase {
LDAPAttributeSet attrs = new LDAPAttributeSet();
// test with a key-value entry.
- Hashtable extAttrsHash = new Hashtable();
+ Hashtable<String, Serializable> extAttrsHash = new Hashtable<String, Serializable>();
extAttrsHash.put("foo;", "bar");
mapper.mapObjectToLDAPAttributeSet(null, null, extAttrsHash, attrs);
@@ -130,7 +131,7 @@ public class ExtAttrDynMapperTest extends CMSBaseTestCase {
// test with a sub-hash.
// this is used by vector/arrays and hashtables
- Hashtable extAttrsValueHash = new Hashtable();
+ Hashtable<String, String> extAttrsValueHash = new Hashtable<String, String>();
extAttrsValueHash.put("Baz", "Val1");
extAttrsValueHash.put("bi;m", "val2");
@@ -182,7 +183,7 @@ public class ExtAttrDynMapperTest extends CMSBaseTestCase {
requestRecord);
assertEquals(1, requestRecord.setCallCounter);
- Hashtable extData = (Hashtable)requestRecord.extAttrData.get(
+ Hashtable<?, ?> extData = (Hashtable<?, ?>)requestRecord.extAttrData.get(
IRequestRecord.ATTR_EXT_DATA);
assertNotNull(extData);
@@ -214,12 +215,12 @@ public class ExtAttrDynMapperTest extends CMSBaseTestCase {
requestRecord);
assertEquals(1, requestRecord.setCallCounter);
- extData = (Hashtable)requestRecord.extAttrData.get(
+ extData = (Hashtable<?, ?>)requestRecord.extAttrData.get(
IRequestRecord.ATTR_EXT_DATA);
assertNotNull(extData);
assertTrue(extData.containsKey("o;key1"));
- Hashtable okey1Data = (Hashtable)extData.get("o;key1");
+ Hashtable<?, ?> okey1Data = (Hashtable<?, ?>)extData.get("o;key1");
assertEquals(3, okey1Data.keySet().size());
assertTrue(okey1Data.containsKey("i;key11"));
assertEquals("val11", (String)okey1Data.get("i;key11"));
@@ -229,7 +230,7 @@ public class ExtAttrDynMapperTest extends CMSBaseTestCase {
assertEquals("val13", (String)okey1Data.get("ikey13"));
assertTrue(extData.containsKey("okey2"));
- Hashtable okey2Data = (Hashtable)extData.get("okey2");
+ Hashtable<?, ?> okey2Data = (Hashtable<?, ?>)extData.get("okey2");
assertEquals(2, okey2Data.keySet().size());
assertTrue(okey2Data.containsKey("ikey21"));
assertEquals("val21", (String)okey2Data.get("ikey21"));
@@ -261,11 +262,8 @@ public class ExtAttrDynMapperTest extends CMSBaseTestCase {
class RequestRecordStub extends RequestRecordDefaultStub {
- /**
- *
- */
private static final long serialVersionUID = 4106967075497999274L;
- Hashtable extAttrData = new Hashtable();
+ Hashtable<String, Object> extAttrData = new Hashtable<String, Object>();
int setCallCounter = 0;
diff --git a/pki/base/util/src/netscape/security/util/ASN1CharStrConvMap.java b/pki/base/util/src/netscape/security/util/ASN1CharStrConvMap.java
index 5df6baef8..da0fd45c5 100644
--- a/pki/base/util/src/netscape/security/util/ASN1CharStrConvMap.java
+++ b/pki/base/util/src/netscape/security/util/ASN1CharStrConvMap.java
@@ -67,8 +67,8 @@ public class ASN1CharStrConvMap
{
Byte tagObj = Byte.valueOf(tag);
CharToByteConverter cbc = null;
- Class cbcClass;
- cbcClass = (Class)tag2CBC.get(tagObj);
+ Class<CharToByteConverter> cbcClass;
+ cbcClass = (Class<CharToByteConverter>)tag2CBC.get(tagObj);
if (cbcClass == null)
return null;
cbc = (CharToByteConverter)cbcClass.newInstance();
@@ -94,7 +94,7 @@ public class ASN1CharStrConvMap
{
Byte tagObj = Byte.valueOf(tag);
ByteToCharConverter bcc = null;
- Class bccClass = (Class)tag2BCC.get(tagObj);
+ Class<ByteToCharConverter> bccClass = tag2BCC.get(tagObj);
if (bccClass == null)
return null;
bcc = (ByteToCharConverter)bccClass.newInstance();
@@ -110,14 +110,15 @@ public class ASN1CharStrConvMap
* @param cbc A CharToByteConverter for the tag.
* @param bcc A ByteToCharConverter for the tag.
*/
- public void addEntry(byte tag, Class cbc, Class bcc)
+ @SuppressWarnings("unchecked")
+ public void addEntry(byte tag, Class<?> cbc, Class<?> bcc)
{
- Class current_cbc;
- Class current_bcc;
+ Class<CharToByteConverter> current_cbc;
+ Class<ByteToCharConverter> current_bcc;
Byte tagByte = Byte.valueOf(tag);
- current_cbc = (Class)tag2CBC.get(tagByte);
- current_bcc = (Class)tag2BCC.get(tagByte);
+ current_cbc = (Class<CharToByteConverter>)tag2CBC.get(tagByte);
+ current_bcc = (Class<ByteToCharConverter>)tag2BCC.get(tagByte);
if (current_cbc != null || current_bcc != null)
{
if (current_cbc != cbc || current_bcc != bcc)
@@ -134,15 +135,15 @@ public class ASN1CharStrConvMap
throw new IllegalArgumentException(
"arguments not a CharToByteConverter or ByteToCharConverter");
}
- tag2CBC.put(tagByte, cbc);
- tag2BCC.put(tagByte, bcc);
+ tag2CBC.put(tagByte, (Class<CharToByteConverter>) cbc);
+ tag2BCC.put(tagByte, (Class<ByteToCharConverter>) bcc);
}
/**
* Get and enumeration of all tags in the map.
* @return An Enumeration of DER tags in the map as Bytes.
*/
- public Enumeration getTags()
+ public Enumeration<Byte> getTags()
{
return tag2CBC.keys();
}
@@ -172,8 +173,8 @@ public class ASN1CharStrConvMap
// private methods and variables.
- private Hashtable tag2CBC = new Hashtable();
- private Hashtable tag2BCC = new Hashtable();
+ private Hashtable<Byte, Class<CharToByteConverter>> tag2CBC = new Hashtable<Byte, Class<CharToByteConverter>>();
+ private Hashtable<Byte, Class<ByteToCharConverter>> tag2BCC = new Hashtable<Byte, Class<ByteToCharConverter>>();
private static ASN1CharStrConvMap defaultMap;
@@ -183,7 +184,7 @@ public class ASN1CharStrConvMap
static {
defaultMap = new ASN1CharStrConvMap();
defaultMap.addEntry(DerValue.tag_PrintableString,
- CharToBytePrintable.class, ByteToCharPrintable.class);
+ (Class<?>)CharToBytePrintable.class, (Class<?>)ByteToCharPrintable.class);
defaultMap.addEntry(DerValue.tag_VisibleString,
CharToBytePrintable.class, ByteToCharPrintable.class);
defaultMap.addEntry(DerValue.tag_IA5String,