summaryrefslogtreecommitdiffstats
path: root/pki/base
diff options
context:
space:
mode:
authorAdam Young <ayoung@redhat.com>2011-12-22 16:38:16 -0500
committerAdam Young <ayoung@redhat.com>2011-12-22 16:39:30 -0500
commit69b3870036158b293bcd329fda71cce2e34f09e9 (patch)
tree8046664ef30ee244f0f8855f771ede48648fdecc /pki/base
parentff173996b9a7d2eedb5a31f8235e0de3b9c1adda (diff)
downloadpki-69b3870036158b293bcd329fda71cce2e34f09e9.tar.gz
pki-69b3870036158b293bcd329fda71cce2e34f09e9.tar.xz
pki-69b3870036158b293bcd329fda71cce2e34f09e9.zip
util type safety cleanup
Diffstat (limited to 'pki/base')
-rw-r--r--pki/base/util/src/netscape/security/x509/CRLDistributionPointsExtension.java12
-rw-r--r--pki/base/util/src/netscape/security/x509/CertificatePoliciesExtension.java21
-rw-r--r--pki/base/util/src/netscape/security/x509/CertificatePolicySet.java6
-rw-r--r--pki/base/util/src/netscape/security/x509/FreshestCRLExtension.java11
-rw-r--r--pki/base/util/src/netscape/security/x509/GeneralNames.java4
-rw-r--r--pki/base/util/src/netscape/security/x509/GeneralSubtrees.java10
-rw-r--r--pki/base/util/src/netscape/security/x509/LdapV3DNStrConverter.java8
-rw-r--r--pki/base/util/src/netscape/security/x509/NoticeReference.java4
-rw-r--r--pki/base/util/src/netscape/security/x509/OIDMap.java28
-rw-r--r--pki/base/util/src/netscape/security/x509/PolicyMappingsExtension.java18
-rw-r--r--pki/base/util/src/netscape/security/x509/PolicyQualifiers.java8
-rw-r--r--pki/base/util/src/netscape/security/x509/RDN.java10
-rwxr-xr-xpki/base/util/src/netscape/security/x509/RevokedCertImpl.java16
-rw-r--r--pki/base/util/src/netscape/security/x509/SubjectDirAttributesExtension.java12
-rw-r--r--pki/base/util/src/netscape/security/x509/X500Name.java8
-rw-r--r--pki/base/util/src/netscape/security/x509/X500NameAttrMap.java24
-rwxr-xr-xpki/base/util/src/netscape/security/x509/X509CertImpl.java8
-rw-r--r--pki/base/util/src/netscape/security/x509/X509Key.java2
18 files changed, 106 insertions, 104 deletions
diff --git a/pki/base/util/src/netscape/security/x509/CRLDistributionPointsExtension.java b/pki/base/util/src/netscape/security/x509/CRLDistributionPointsExtension.java
index aa8c20b82..0f64c58b4 100644
--- a/pki/base/util/src/netscape/security/x509/CRLDistributionPointsExtension.java
+++ b/pki/base/util/src/netscape/security/x509/CRLDistributionPointsExtension.java
@@ -319,11 +319,11 @@ public class CRLDistributionPointsExtension extends Extension
list.addElement(this);
}
- private static Hashtable map = new Hashtable();
- private static Vector list = new Vector();
+ private static Hashtable<String, Reason> map = new Hashtable<String, Reason>();
+ private static Vector<Reason> list = new Vector<Reason>();
public static Reason fromString(String name) {
- return (Reason) map.get(name);
+ return map.get(name);
}
public String getName() {
@@ -359,9 +359,9 @@ public class CRLDistributionPointsExtension extends Extension
public static Reason[] bitArrayToReasonArray(byte[] bitFlags) {
byte first = bitFlags[0];
int size = list.size();
- Vector result = new Vector();
+ Vector<Reason> result = new Vector<Reason>();
for(int i = 0; i < size; i++) {
- Reason r = (Reason) list.elementAt(i);
+ Reason r = list.elementAt(i);
byte b = r.getBitMask();
if( (first & b) != 0 ) {
result.addElement(r);
@@ -370,7 +370,7 @@ public class CRLDistributionPointsExtension extends Extension
size = result.size();
Reason[] retval = new Reason[size];
for(int i=0; i < size; i++) {
- retval[i] = (Reason) result.elementAt(i);
+ retval[i] = result.elementAt(i);
}
return retval;
}
diff --git a/pki/base/util/src/netscape/security/x509/CertificatePoliciesExtension.java b/pki/base/util/src/netscape/security/x509/CertificatePoliciesExtension.java
index 106cc4500..4c3c4fa08 100644
--- a/pki/base/util/src/netscape/security/x509/CertificatePoliciesExtension.java
+++ b/pki/base/util/src/netscape/security/x509/CertificatePoliciesExtension.java
@@ -70,7 +70,7 @@ implements CertAttrSet {
// Private data members
- private Vector mInfos;
+ private Vector<CertificatePolicyInfo> mInfos;
// Encode this extension value
private void encodeThis() throws IOException {
@@ -84,7 +84,7 @@ implements CertAttrSet {
extensionValue = os.toByteArray();
}
- public CertificatePoliciesExtension(boolean critical, Vector infos) throws IOException {
+ public CertificatePoliciesExtension(boolean critical, Vector<CertificatePolicyInfo> infos) throws IOException {
this.mInfos = infos;
this.extensionId = PKIXExtensions.CertificatePolicies_Id;
this.critical = critical;
@@ -96,7 +96,7 @@ implements CertAttrSet {
*
* @param infos the Vector of CertificatePolicyInfo.
*/
- public CertificatePoliciesExtension(Vector infos) throws IOException {
+ public CertificatePoliciesExtension(Vector<CertificatePolicyInfo> infos) throws IOException {
this.mInfos = infos;
this.extensionId = PKIXExtensions.CertificatePolicies_Id;
this.critical = false;
@@ -109,7 +109,7 @@ implements CertAttrSet {
public CertificatePoliciesExtension() {
this.extensionId = PKIXExtensions.CertificatePolicies_Id;
critical = false;
- mInfos = new Vector(1,1);
+ mInfos = new Vector<CertificatePolicyInfo>(1,1);
}
/**
@@ -135,7 +135,7 @@ implements CertAttrSet {
throw new IOException("Invalid encoding for " +
"CertificatePoliciesExtension.");
}
- mInfos = new Vector(1, 1);
+ mInfos = new Vector<CertificatePolicyInfo>(1, 1);
while (val.data.available() != 0) {
DerValue seq = val.data.getDerValue();
CertificatePolicyInfo info = new CertificatePolicyInfo(seq);
@@ -184,14 +184,15 @@ implements CertAttrSet {
/**
* Set the attribute value.
*/
- public void set(String name, Object obj) throws IOException {
+ @SuppressWarnings("unchecked")
+ public void set(String name, Object obj) throws IOException {
clearValue();
if (name.equalsIgnoreCase(INFOS)) {
if (!(obj instanceof Vector)) {
throw new IOException("Attribute value should be of" +
" type Vector.");
}
- mInfos = (Vector)obj;
+ mInfos = (Vector<CertificatePolicyInfo>)obj;
} else {
throw new IOException("Attribute name not recognized by " +
"CertAttrSet:CertificatePoliciesExtension.");
@@ -226,8 +227,8 @@ implements CertAttrSet {
* Return an enumeration of names of attributes existing within this
* attribute.
*/
- public Enumeration getElements () {
- Vector elements = new Vector();
+ public Enumeration<Vector<CertificatePolicyInfo>> getElements () {
+ Vector<Vector<CertificatePolicyInfo>> elements = new Vector<Vector<CertificatePolicyInfo>>();
elements.addElement(mInfos);
return (elements.elements());
}
@@ -312,7 +313,7 @@ implements CertAttrSet {
qualifiers1.add(qualifierInfo1);
CertificatePolicyInfo info1 = new CertificatePolicyInfo(
plcyId1, qualifiers1);
- Vector infos = new Vector();
+ Vector<CertificatePolicyInfo> infos = new Vector<CertificatePolicyInfo>();
infos.addElement(info0);
infos.addElement(info1);
try {
diff --git a/pki/base/util/src/netscape/security/x509/CertificatePolicySet.java b/pki/base/util/src/netscape/security/x509/CertificatePolicySet.java
index eaf215141..fafa7764d 100644
--- a/pki/base/util/src/netscape/security/x509/CertificatePolicySet.java
+++ b/pki/base/util/src/netscape/security/x509/CertificatePolicySet.java
@@ -32,14 +32,14 @@ import netscape.security.util.DerValue;
* @version 1.4
*/
public class CertificatePolicySet {
- private Vector ids;
+ private Vector<CertificatePolicyId> ids;
/**
* The default constructor for this class.
*
* @param ids the sequence of CertificatePolicyId's.
*/
- public CertificatePolicySet(Vector ids) {
+ public CertificatePolicySet(Vector<CertificatePolicyId> ids) {
this.ids = ids;
}
@@ -50,7 +50,7 @@ public class CertificatePolicySet {
* @exception IOException on decoding errors.
*/
public CertificatePolicySet(DerInputStream in) throws IOException {
- ids = new Vector(1, 1);
+ ids = new Vector<CertificatePolicyId>(1, 1);
DerValue[] seq = in.getSequence(5);
for (int i = 0; i < seq.length; i++) {
diff --git a/pki/base/util/src/netscape/security/x509/FreshestCRLExtension.java b/pki/base/util/src/netscape/security/x509/FreshestCRLExtension.java
index ac8e2504f..dd4bdd172 100644
--- a/pki/base/util/src/netscape/security/x509/FreshestCRLExtension.java
+++ b/pki/base/util/src/netscape/security/x509/FreshestCRLExtension.java
@@ -29,6 +29,7 @@ import java.util.Vector;
import netscape.security.util.BitArray;
import netscape.security.util.DerOutputStream;
+import netscape.security.x509.FreshestCRLExtension.Reason;
import org.mozilla.jss.asn1.ASN1Util;
import org.mozilla.jss.asn1.InvalidBERException;
@@ -324,11 +325,11 @@ public class FreshestCRLExtension extends Extension
list.addElement(this);
}
- private static Hashtable map = new Hashtable();
- private static Vector list = new Vector();
+ private static Hashtable<String, Reason> map = new Hashtable<String, Reason>();
+ private static Vector<Reason> list = new Vector<Reason>();
public static Reason fromString(String name) {
- return (Reason) map.get(name);
+ return map.get(name);
}
public String getName() {
@@ -364,7 +365,7 @@ public class FreshestCRLExtension extends Extension
public static Reason[] bitArrayToReasonArray(byte[] bitFlags) {
byte first = bitFlags[0];
int size = list.size();
- Vector result = new Vector();
+ Vector<Reason> result = new Vector<Reason>();
for(int i = 0; i < size; i++) {
Reason r = (Reason) list.elementAt(i);
byte b = r.getBitMask();
@@ -375,7 +376,7 @@ public class FreshestCRLExtension extends Extension
size = result.size();
Reason[] retval = new Reason[size];
for(int i=0; i < size; i++) {
- retval[i] = (Reason) result.elementAt(i);
+ retval[i] = result.elementAt(i);
}
return retval;
}
diff --git a/pki/base/util/src/netscape/security/x509/GeneralNames.java b/pki/base/util/src/netscape/security/x509/GeneralNames.java
index 767e0fe3e..d647dd96e 100644
--- a/pki/base/util/src/netscape/security/x509/GeneralNames.java
+++ b/pki/base/util/src/netscape/security/x509/GeneralNames.java
@@ -35,7 +35,7 @@ import netscape.security.util.DerValue;
* @author Hemma Prafullchandra
* @version 1.7
*/
-public class GeneralNames extends Vector {
+public class GeneralNames extends Vector<GeneralNameInterface> {
/**
*
*/
@@ -107,7 +107,7 @@ public class GeneralNames extends Vector {
throws IOException, GeneralNamesException {
if (size() == 0) { return; }
- Enumeration names = elements();
+ Enumeration<GeneralNameInterface> names = elements();
DerOutputStream temp = new DerOutputStream();
while (names.hasMoreElements()) {
diff --git a/pki/base/util/src/netscape/security/x509/GeneralSubtrees.java b/pki/base/util/src/netscape/security/x509/GeneralSubtrees.java
index 332f61cdd..840fdf9e5 100644
--- a/pki/base/util/src/netscape/security/x509/GeneralSubtrees.java
+++ b/pki/base/util/src/netscape/security/x509/GeneralSubtrees.java
@@ -34,7 +34,7 @@ import netscape.security.util.PrettyPrintFormat;
* @author Hemma Prafullchandra
*/
public class GeneralSubtrees {
- private Vector trees;
+ private Vector<GeneralSubtree> trees;
private PrettyPrintFormat pp = new PrettyPrintFormat(":");
/**
@@ -42,7 +42,7 @@ public class GeneralSubtrees {
*
* @param trees the sequence of GeneralSubtree.
*/
- public GeneralSubtrees(Vector trees) {
+ public GeneralSubtrees(Vector<GeneralSubtree> trees) {
this.trees = trees;
}
@@ -52,7 +52,7 @@ public class GeneralSubtrees {
* @param val the DER encoded form of the same.
*/
public GeneralSubtrees(DerValue val) throws IOException {
- trees = new Vector(1, 1);
+ trees = new Vector<GeneralSubtree>(1, 1);
if (val.tag != DerValue.tag_Sequence) {
throw new IOException("Invalid encoding of GeneralSubtrees.");
}
@@ -78,7 +78,7 @@ public class GeneralSubtrees {
String s = "";
GeneralSubtree element;
- for (Enumeration e = trees.elements() ; e.hasMoreElements() ;) {
+ for (Enumeration<GeneralSubtree> e = trees.elements() ; e.hasMoreElements() ;) {
element = (GeneralSubtree) e.nextElement();
s = s + pp.indent(indent+4)+ element.toPrint(indent) +"\n";
}
@@ -100,7 +100,7 @@ public class GeneralSubtrees {
out.write(DerValue.tag_Sequence,seq);
}
- public Vector getSubtrees() {
+ public Vector<GeneralSubtree> getSubtrees() {
return trees;
}
}
diff --git a/pki/base/util/src/netscape/security/x509/LdapV3DNStrConverter.java b/pki/base/util/src/netscape/security/x509/LdapV3DNStrConverter.java
index 8203d9b08..114cc64a1 100644
--- a/pki/base/util/src/netscape/security/x509/LdapV3DNStrConverter.java
+++ b/pki/base/util/src/netscape/security/x509/LdapV3DNStrConverter.java
@@ -108,7 +108,7 @@ public class LdapV3DNStrConverter extends LdapDNStrConverter
{
StringReader dn_reader = new StringReader(dn);
PushbackReader in = new PushbackReader(dn_reader, 5);
- Vector rdnVector = new Vector();
+ Vector<RDN> rdnVector = new Vector<RDN>();
RDN[] names;
return parseDN(in, encodingOrder);
@@ -136,7 +136,7 @@ public class LdapV3DNStrConverter extends LdapDNStrConverter
{
StringReader rdn_reader = new StringReader(rdn);
PushbackReader in = new PushbackReader(rdn_reader, 5);
- Vector avaVector = new Vector();
+ Vector<AVA> avaVector = new Vector<AVA>();
AVA[] assertion;
return parseRDN(in, null);
@@ -197,7 +197,7 @@ public class LdapV3DNStrConverter extends LdapDNStrConverter
{
RDN rdn;
int lastChar;
- Vector rdnVector = new Vector();
+ Vector<RDN> rdnVector = new Vector<RDN>();
RDN names[];
int i,j;
@@ -240,7 +240,7 @@ public class LdapV3DNStrConverter extends LdapDNStrConverter
public RDN parseRDN(PushbackReader in, byte[] encodingOrder)
throws IOException
{
- Vector avaVector = new Vector();
+ Vector<AVA> avaVector = new Vector<AVA>();
AVA ava;
int lastChar;
AVA assertion[];
diff --git a/pki/base/util/src/netscape/security/x509/NoticeReference.java b/pki/base/util/src/netscape/security/x509/NoticeReference.java
index 9098d8163..9c232f3ca 100644
--- a/pki/base/util/src/netscape/security/x509/NoticeReference.java
+++ b/pki/base/util/src/netscape/security/x509/NoticeReference.java
@@ -54,7 +54,7 @@ public class NoticeReference {
if (integers.tag != DerValue.tag_Sequence) {
throw new IOException("Invalid encoding for NoticeReference (integers)");
}
- Vector num = new Vector();
+ Vector<BigInt> num = new Vector<BigInt>();
while (integers.data.available() != 0) {
DerValue i = integers.data.getDerValue();
BigInt bigI = i.getInteger();
@@ -64,7 +64,7 @@ public class NoticeReference {
return;
mNumbers = new int[num.size()];
for (int i = 0; i < num.size(); i++) {
- mNumbers[i] = ((BigInt)num.elementAt(i)).toInt();
+ mNumbers[i] = num.elementAt(i).toInt();
}
}
diff --git a/pki/base/util/src/netscape/security/x509/OIDMap.java b/pki/base/util/src/netscape/security/x509/OIDMap.java
index 082ecc4fd..be1e088e8 100644
--- a/pki/base/util/src/netscape/security/x509/OIDMap.java
+++ b/pki/base/util/src/netscape/security/x509/OIDMap.java
@@ -21,8 +21,8 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.cert.CertificateException;
-import java.util.Enumeration;
import java.util.Hashtable;
+import java.util.Iterator;
import java.util.Properties;
import netscape.security.util.ObjectIdentifier;
@@ -91,9 +91,9 @@ public class OIDMap {
private static final String CRL_REASON = ROOT + "." +
CRLReasonExtension.NAME;
- private static final Hashtable oid2Name = new Hashtable();
- private static final Hashtable name2OID = new Hashtable();
- private static final Hashtable name2Class = new Hashtable();
+ private static final Hashtable<ObjectIdentifier, String> oid2Name = new Hashtable<ObjectIdentifier, String>();
+ private static final Hashtable<String, ObjectIdentifier> name2OID = new Hashtable<String, ObjectIdentifier>();
+ private static final Hashtable<String, String> name2Class = new Hashtable<String, String>();
// Initialize recognized extensions from EXTENSIONS_{OIDS/CLASSES} files
static {
@@ -174,9 +174,9 @@ public class OIDMap {
}
}
- Enumeration names = props.propertyNames();
- while (names.hasMoreElements()) {
- String name = (String)names.nextElement();
+ Iterator<String> names = props.stringPropertyNames().iterator();
+ while (names.hasNext()) {
+ String name = names.next();
String oidName = props.getProperty(name);
ObjectIdentifier oid = new ObjectIdentifier(oidName);
@@ -201,9 +201,9 @@ public class OIDMap {
}
}
- Enumeration names = props.propertyNames();
- while (names.hasMoreElements()) {
- String name = (String)names.nextElement();
+ Iterator<String> names = props.stringPropertyNames().iterator();
+ while (names.hasNext()) {
+ String name = names.next();
String className = props.getProperty(name);
name2Class.put(name, className);
@@ -265,12 +265,12 @@ public class OIDMap {
* @param name the user friendly name.
* @exception CertificateException if class cannot be instantiated.
*/
- public static Class getClass(String name) throws CertificateException {
+ public static Class<?> getClass(String name) throws CertificateException {
String className = (String)name2Class.get(name);
if (className == null)
return null;
try {
- Class extClass = Class.forName(className);
+ Class<?> extClass = Class.forName(className);
return (extClass);
} catch (Exception e) {
throw new CertificateException("Error instantiating class for "
@@ -284,7 +284,7 @@ public class OIDMap {
* @param oid the name of the object identifier to be returned.
* @exception CertificateException if class cannot be instatiated.
*/
- public static Class getClass(ObjectIdentifier oid)
+ public static Class<?> getClass(ObjectIdentifier oid)
throws CertificateException {
String name = getName(oid);
if (name == null)
@@ -293,7 +293,7 @@ public class OIDMap {
if (className == null)
return null;
try {
- Class extClass = Class.forName(className);
+ Class<?> extClass = Class.forName(className);
return (extClass);
} catch (Exception e) {
throw new CertificateException("Error instantiating class for "
diff --git a/pki/base/util/src/netscape/security/x509/PolicyMappingsExtension.java b/pki/base/util/src/netscape/security/x509/PolicyMappingsExtension.java
index 90dd5267d..48f0b0428 100644
--- a/pki/base/util/src/netscape/security/x509/PolicyMappingsExtension.java
+++ b/pki/base/util/src/netscape/security/x509/PolicyMappingsExtension.java
@@ -65,7 +65,7 @@ implements CertAttrSet {
public static final String MAP = "map";
// Private data members
- private Vector maps = null;
+ private Vector<CertificatePolicyMap> maps = null;
// Encode this extension value
private void encodeThis() throws IOException {
@@ -84,7 +84,7 @@ implements CertAttrSet {
*
* @param maps the Vector of CertificatePolicyMap.
*/
- public PolicyMappingsExtension(Vector map) throws IOException {
+ public PolicyMappingsExtension(Vector<CertificatePolicyMap> map) throws IOException {
init(false, map);
}
@@ -93,7 +93,7 @@ implements CertAttrSet {
*
* @param maps the Vector of CertificatePolicyMap.
*/
- public PolicyMappingsExtension(boolean critical, Vector map)
+ public PolicyMappingsExtension(boolean critical, Vector<CertificatePolicyMap> map)
throws IOException {
init(critical, map);
}
@@ -101,7 +101,7 @@ implements CertAttrSet {
/**
* init policy with criticality and map.
*/
- private void init(boolean critical, Vector map) throws IOException {
+ private void init(boolean critical, Vector<CertificatePolicyMap> map) throws IOException {
this.maps = map;
this.extensionId = PKIXExtensions.PolicyMappings_Id;
this.critical = critical;
@@ -114,7 +114,7 @@ implements CertAttrSet {
public PolicyMappingsExtension() {
extensionId = PKIXExtensions.PolicyMappings_Id;
critical = false;
- maps = new Vector(1,1);
+ maps = new Vector<CertificatePolicyMap>(1,1);
}
/**
@@ -140,7 +140,7 @@ implements CertAttrSet {
throw new IOException("Invalid encoding for " +
"PolicyMappingsExtension.");
}
- maps = new Vector(1, 1);
+ maps = new Vector<CertificatePolicyMap>(1, 1);
while (val.data.available() != 0) {
DerValue seq = val.data.getDerValue();
CertificatePolicyMap map = new CertificatePolicyMap(seq);
@@ -189,14 +189,14 @@ implements CertAttrSet {
/**
* Set the attribute value.
*/
- public void set(String name, Object obj) throws IOException {
+ public void set(String name, Object obj) throws IOException {
clearValue();
if (name.equalsIgnoreCase(MAP)) {
if (!(obj instanceof Vector)) {
throw new IOException("Attribute value should be of" +
" type Vector.");
}
- maps = (Vector)obj;
+ maps = (Vector<CertificatePolicyMap>)obj;
} else {
throw new IOException("Attribute name not recognized by " +
"CertAttrSet:PolicyMappingsExtension.");
@@ -248,7 +248,7 @@ implements CertAttrSet {
/**
* Returns an enumeration of the mappings in the extension.
*/
- public Enumeration getMappings() {
+ public Enumeration<CertificatePolicyMap> getMappings() {
if (maps == null)
return null;
return maps.elements();
diff --git a/pki/base/util/src/netscape/security/x509/PolicyQualifiers.java b/pki/base/util/src/netscape/security/x509/PolicyQualifiers.java
index 5d04e0f98..fd2c161b2 100644
--- a/pki/base/util/src/netscape/security/x509/PolicyQualifiers.java
+++ b/pki/base/util/src/netscape/security/x509/PolicyQualifiers.java
@@ -37,7 +37,7 @@ public class PolicyQualifiers implements java.io.Serializable {
*
*/
private static final long serialVersionUID = 6932694408774694516L;
- private Vector mInfo = new Vector();
+ private Vector<PolicyQualifierInfo> mInfo = new Vector<PolicyQualifierInfo>();
/**
* Create a PolicyQualifiers with the ObjectIdentifier.
@@ -73,7 +73,7 @@ public class PolicyQualifiers implements java.io.Serializable {
}
public PolicyQualifierInfo getInfoAt(int i) {
- return (PolicyQualifierInfo)mInfo.elementAt(i);
+ return mInfo.elementAt(i);
}
/**
@@ -82,7 +82,7 @@ public class PolicyQualifiers implements java.io.Serializable {
public String toString() {
String s = "PolicyQualifiers: [";
for (int i = 0; i < mInfo.size(); i++) {
- PolicyQualifierInfo pq = (PolicyQualifierInfo)mInfo.elementAt(i);
+ PolicyQualifierInfo pq = mInfo.elementAt(i);
s = s + pq.toString();
}
s = s + "]\n";
@@ -100,7 +100,7 @@ public class PolicyQualifiers implements java.io.Serializable {
DerOutputStream tmp = new DerOutputStream();
for (int i = 0; i < mInfo.size(); i++) {
- PolicyQualifierInfo pq = (PolicyQualifierInfo)mInfo.elementAt(i);
+ PolicyQualifierInfo pq = mInfo.elementAt(i);
pq.encode(tmp);
}
diff --git a/pki/base/util/src/netscape/security/x509/RDN.java b/pki/base/util/src/netscape/security/x509/RDN.java
index 347fc4e1d..3ea5afbc7 100644
--- a/pki/base/util/src/netscape/security/x509/RDN.java
+++ b/pki/base/util/src/netscape/security/x509/RDN.java
@@ -158,12 +158,12 @@ class RDN
/**
* convenience method.
*/
- public RDN(Vector avaVector)
+ public RDN(Vector<AVA> avaVector)
{
int size = avaVector.size();
assertion = new AVA[size];
for (int i = 0; i < size; i++) {
- assertion[i] = (AVA)avaVector.elementAt(i);
+ assertion[i] = avaVector.elementAt(i);
}
}
@@ -187,7 +187,7 @@ class RDN
private AVA assertion [];
- private class AVAEnumerator implements Enumeration
+ private class AVAEnumerator implements Enumeration<AVA>
{
private int index;
@@ -198,7 +198,7 @@ class RDN
return (index < assertion.length);
}
- public Object nextElement()
+ public AVA nextElement()
{
AVA ava = null;
if (index >= assertion.length)
@@ -262,7 +262,7 @@ class RDN
* returns an enumeration of AVAs that make up this RDN.
* @return an enumeration of AVAs that make up this RDN.
*/
- public Enumeration getAVAs()
+ public Enumeration<AVA> getAVAs()
{
return new AVAEnumerator();
}
diff --git a/pki/base/util/src/netscape/security/x509/RevokedCertImpl.java b/pki/base/util/src/netscape/security/x509/RevokedCertImpl.java
index 99bd1665d..ed78be9b8 100755
--- a/pki/base/util/src/netscape/security/x509/RevokedCertImpl.java
+++ b/pki/base/util/src/netscape/security/x509/RevokedCertImpl.java
@@ -291,14 +291,14 @@ public class RevokedCertImpl extends RevokedCertificate
* @return a set of the extension oid strings in the
* Object that are marked critical.
*/
- public Set getCriticalExtensionOIDs() {
+ public Set<String> getCriticalExtensionOIDs() {
if (extensions == null)
return null;
- Set extSet = new TreeSet();
+ Set<String> extSet = new TreeSet<String>();
Extension ex;
- for (Enumeration e = extensions.getElements();
+ for (Enumeration<Extension> e = extensions.getElements();
e.hasMoreElements();) {
- ex = (Extension)e.nextElement();
+ ex = e.nextElement();
if (ex.isCritical())
extSet.add(((ObjectIdentifier)ex.getExtensionId()).toString());
}
@@ -312,12 +312,12 @@ public class RevokedCertImpl extends RevokedCertificate
* @return a set of the extension oid strings in the
* Object that are marked critical.
*/
- public Set getNonCriticalExtensionOIDs() {
+ public Set<String> getNonCriticalExtensionOIDs() {
if (extensions == null)
return null;
- Set extSet = new TreeSet();
+ Set<String> extSet = new TreeSet<String>();
Extension ex;
- for (Enumeration e = extensions.getElements();
+ for (Enumeration<Extension> e = extensions.getElements();
e.hasMoreElements();) {
ex = (Extension)e.nextElement();
if ( ! ex.isCritical())
@@ -349,7 +349,7 @@ public class RevokedCertImpl extends RevokedCertificate
ObjectIdentifier findOID = new ObjectIdentifier(oid);
Extension ex = null;
ObjectIdentifier inCertOID;
- for (Enumeration e=extensions.getElements();
+ for (Enumeration<Extension> e=extensions.getElements();
e.hasMoreElements();) {
ex = (Extension)e.nextElement();
inCertOID = ex.getExtensionId();
diff --git a/pki/base/util/src/netscape/security/x509/SubjectDirAttributesExtension.java b/pki/base/util/src/netscape/security/x509/SubjectDirAttributesExtension.java
index da9170f3f..e5ece1bed 100644
--- a/pki/base/util/src/netscape/security/x509/SubjectDirAttributesExtension.java
+++ b/pki/base/util/src/netscape/security/x509/SubjectDirAttributesExtension.java
@@ -77,7 +77,7 @@ implements CertAttrSet {
public static final String NAME = "SubjectDirectoryAttributes";
// Private data members
- private Vector attrList = new Vector();
+ private Vector<Attribute> attrList = new Vector<Attribute>();
// Encode this extension value
private void encodeThis() throws IOException {
@@ -85,9 +85,9 @@ implements CertAttrSet {
DerOutputStream tmp = new DerOutputStream();
//encoding the attributes
- Enumeration attrs = attrList.elements();
+ Enumeration<Attribute> attrs = attrList.elements();
while (attrs.hasMoreElements()) {
- Attribute attr = (Attribute) attrs.nextElement();
+ Attribute attr = attrs.nextElement();
attr.encode(tmp);
}
@@ -199,9 +199,9 @@ implements CertAttrSet {
public String toString() {
String s = super.toString() + "SubjectDirectoryAttributes:[\n";
- Enumeration attrs = attrList.elements();
+ Enumeration<Attribute> attrs = attrList.elements();
while (attrs.hasMoreElements()) {
- Attribute attr = (Attribute) attrs.nextElement();
+ Attribute attr = attrs.nextElement();
s += attr.toString();
}
@@ -278,7 +278,7 @@ implements CertAttrSet {
/**
* Returns an enumeration of attributes in the extension.
*/
- public Enumeration getAttributesList() {
+ public Enumeration<Attribute> getAttributesList() {
if (attrList == null)
return null;
return attrList.elements();
diff --git a/pki/base/util/src/netscape/security/x509/X500Name.java b/pki/base/util/src/netscape/security/x509/X500Name.java
index c9980d3dc..9efe6c002 100644
--- a/pki/base/util/src/netscape/security/x509/X500Name.java
+++ b/pki/base/util/src/netscape/security/x509/X500Name.java
@@ -291,7 +291,7 @@ public class X500Name implements Principal, GeneralNameInterface {
* convenience method.
* @param rdns a vector of rdns.
*/
- public X500Name (Vector rdnVector)
+ public X500Name (Vector<RDN> rdnVector)
throws IOException
{
int size = rdnVector.size();
@@ -550,7 +550,7 @@ public class X500Name implements Principal, GeneralNameInterface {
* Returns an enumerator of RDNs in the X500Name.
* @return enumeration of rdns in this X500Name.
*/
- public Enumeration getRDNs()
+ public Enumeration<RDN> getRDNs()
{
return new RDNEnumerator();
}
@@ -672,7 +672,7 @@ public class X500Name implements Principal, GeneralNameInterface {
dn = ldapDNStrConverter.encodeDN(this);
}
- private class RDNEnumerator implements Enumeration
+ private class RDNEnumerator implements Enumeration<RDN>
{
private int index;
@@ -683,7 +683,7 @@ public class X500Name implements Principal, GeneralNameInterface {
return (index < names.length);
}
- public Object nextElement()
+ public RDN nextElement()
{
if (index >= names.length)
return null;
diff --git a/pki/base/util/src/netscape/security/x509/X500NameAttrMap.java b/pki/base/util/src/netscape/security/x509/X500NameAttrMap.java
index 60722924a..48bb83021 100644
--- a/pki/base/util/src/netscape/security/x509/X500NameAttrMap.java
+++ b/pki/base/util/src/netscape/security/x509/X500NameAttrMap.java
@@ -61,7 +61,7 @@ public class X500NameAttrMap
public String getName(ObjectIdentifier oid)
{
// XXX assert oid != null
- return (String)oid2Name.get(oid);
+ return oid2Name.get(oid);
}
/**
@@ -74,7 +74,7 @@ public class X500NameAttrMap
public ObjectIdentifier getOid(String name)
{
// XXX assert name != null
- return (ObjectIdentifier)name2OID.get(name.toUpperCase());
+ return name2OID.get(name.toUpperCase());
}
/**
@@ -86,7 +86,7 @@ public class X500NameAttrMap
*/
public AVAValueConverter getValueConverter(String name)
{
- ObjectIdentifier oid = (ObjectIdentifier)
+ ObjectIdentifier oid =
name2OID.get(name.toUpperCase());
if (oid == null) return null;
return (AVAValueConverter)oid2ValueConverter.get(oid);
@@ -109,7 +109,7 @@ public class X500NameAttrMap
*
* @return An Enumeration of all attribute names.
*/
- public Enumeration getAllNames()
+ public Enumeration<String> getAllNames()
{
return name2OID.keys();
}
@@ -119,7 +119,7 @@ public class X500NameAttrMap
*
* @return An Enumeration of all OIDs in this map.
*/
- public Enumeration getAllOIDs()
+ public Enumeration<ObjectIdentifier> getAllOIDs()
{
return oid2Name.keys();
}
@@ -132,10 +132,10 @@ public class X500NameAttrMap
*/
public ObjectIdentifier getOid(ObjectIdentifier oid)
{
- String name = (String)oid2Name.get(oid);
+ String name = oid2Name.get(oid);
if (name == null)
return null;
- return (ObjectIdentifier)name2OID.get(name);
+ return name2OID.get(name);
}
@@ -158,9 +158,9 @@ public class X500NameAttrMap
{
// normalize name for case insensitive compare.
ObjectIdentifier theOid;
- Class expValueConverter;
+ Class<? extends AVAValueConverter> expValueConverter;
- theOid = (ObjectIdentifier)name2OID.get(name);
+ theOid = name2OID.get(name);
if (theOid != null) {
expValueConverter = oid2ValueConverter.get(theOid).getClass();
if (!theOid.equals(oid) ||
@@ -217,9 +217,9 @@ public class X500NameAttrMap
// private variables
//
- Hashtable name2OID = new Hashtable();
- Hashtable oid2Name = new Hashtable();
- Hashtable oid2ValueConverter = new Hashtable();
+ Hashtable<String, ObjectIdentifier> name2OID = new Hashtable<String, ObjectIdentifier>();
+ Hashtable<ObjectIdentifier, String> oid2Name = new Hashtable<ObjectIdentifier, String>();
+ Hashtable<ObjectIdentifier, AVAValueConverter> oid2ValueConverter = new Hashtable<ObjectIdentifier, AVAValueConverter>();
//
// global defaults.
diff --git a/pki/base/util/src/netscape/security/x509/X509CertImpl.java b/pki/base/util/src/netscape/security/x509/X509CertImpl.java
index bb1b441a0..c916a5d76 100755
--- a/pki/base/util/src/netscape/security/x509/X509CertImpl.java
+++ b/pki/base/util/src/netscape/security/x509/X509CertImpl.java
@@ -905,7 +905,7 @@ implements Serializable, DerEncoder {
* @return a set of the extension oid strings in the
* certificate that are marked critical.
*/
- public Set getCriticalExtensionOIDs() {
+ public Set<String> getCriticalExtensionOIDs() {
if (info == null)
return null;
try {
@@ -913,7 +913,7 @@ implements Serializable, DerEncoder {
CertificateExtensions.NAME);
if (exts == null)
return null;
- Set<String> extSet = new TreeSet();
+ Set<String> extSet = new TreeSet<String>();
Extension ex;
for (Enumeration e = exts.getElements(); e.hasMoreElements(); ) {
ex = (Extension)e.nextElement();
@@ -933,7 +933,7 @@ implements Serializable, DerEncoder {
* @return a set of the extension oid strings in the
* certificate that are NOT marked critical.
*/
- public Set getNonCriticalExtensionOIDs() {
+ public Set<String> getNonCriticalExtensionOIDs() {
if (info == null)
return null;
try {
@@ -942,7 +942,7 @@ implements Serializable, DerEncoder {
if (exts == null)
return null;
- Set extSet = new TreeSet();
+ Set<String> extSet = new TreeSet<String>();
Extension ex;
for (Enumeration e = exts.getElements(); e.hasMoreElements(); ) {
ex = (Extension)e.nextElement();
diff --git a/pki/base/util/src/netscape/security/x509/X509Key.java b/pki/base/util/src/netscape/security/x509/X509Key.java
index 9d5f86a90..81422ea41 100644
--- a/pki/base/util/src/netscape/security/x509/X509Key.java
+++ b/pki/base/util/src/netscape/security/x509/X509Key.java
@@ -201,7 +201,7 @@ public class X509Key implements PublicKey {
throw new InstantiationException();
}
- Class keyClass = Class.forName(classname);
+ Class<?> keyClass = Class.forName(classname);
Object inst;
X509Key result;