diff options
author | Endi Sukma Dewata <edewata@redhat.com> | 2012-04-05 15:08:18 -0500 |
---|---|---|
committer | Endi Sukma Dewata <edewata@redhat.com> | 2012-04-09 10:22:03 -0500 |
commit | 3f24e55923fc986af4c6a08b2b8d45704a905627 (patch) | |
tree | 716415853b5676b801f6707634305b59b9af8603 /base/util/src | |
parent | 7c7b9d023cd466c1771068badc020dab36beb553 (diff) | |
download | pki-3f24e55923fc986af4c6a08b2b8d45704a905627.tar.gz pki-3f24e55923fc986af4c6a08b2b8d45704a905627.tar.xz pki-3f24e55923fc986af4c6a08b2b8d45704a905627.zip |
Removed unnecessary type casts.
Unnecessary type casts have been removed using Eclipse Quick Fix.
Ticket #134
Diffstat (limited to 'base/util/src')
61 files changed, 165 insertions, 179 deletions
diff --git a/base/util/src/com/netscape/cmsutil/http/HttpMessage.java b/base/util/src/com/netscape/cmsutil/http/HttpMessage.java index badec5930..398f38400 100644 --- a/base/util/src/com/netscape/cmsutil/http/HttpMessage.java +++ b/base/util/src/com/netscape/cmsutil/http/HttpMessage.java @@ -56,7 +56,7 @@ public class HttpMessage { * get a header */ public String getHeader(String name) { - return (String) mHeaders.get(name.toLowerCase()); + return mHeaders.get(name.toLowerCase()); } /** diff --git a/base/util/src/com/netscape/cmsutil/password/PlainPasswordFile.java b/base/util/src/com/netscape/cmsutil/password/PlainPasswordFile.java index eb43607f0..adad6ee37 100644 --- a/base/util/src/com/netscape/cmsutil/password/PlainPasswordFile.java +++ b/base/util/src/com/netscape/cmsutil/password/PlainPasswordFile.java @@ -44,7 +44,7 @@ public class PlainPasswordFile implements IPasswordStore { } public String getPassword(String tag) { - return (String) mPwdStore.getProperty(tag); + return mPwdStore.getProperty(tag); } // return an array of String-based tag diff --git a/base/util/src/com/netscape/cmsutil/password/PlainPasswordReader.java b/base/util/src/com/netscape/cmsutil/password/PlainPasswordReader.java index 68724a9f6..3a75097ec 100644 --- a/base/util/src/com/netscape/cmsutil/password/PlainPasswordReader.java +++ b/base/util/src/com/netscape/cmsutil/password/PlainPasswordReader.java @@ -43,7 +43,7 @@ public class PlainPasswordReader implements IPasswordReader { } public String getPassword(String tag) { - return (String) mPwdStore.getProperty(tag); + return mPwdStore.getProperty(tag); } // return an array of String-based tag diff --git a/base/util/src/com/netscape/cmsutil/radius/NASPacket.java b/base/util/src/com/netscape/cmsutil/radius/NASPacket.java index 70d143989..18c37af10 100644 --- a/base/util/src/com/netscape/cmsutil/radius/NASPacket.java +++ b/base/util/src/com/netscape/cmsutil/radius/NASPacket.java @@ -30,7 +30,7 @@ public abstract class NASPacket extends Packet { ByteArrayOutputStream attrsOS = new ByteArrayOutputStream(); for (int i = 0; i < _attrs.size(); i++) { - Attribute attr = (Attribute) getAttributeAt(i); + Attribute attr = getAttributeAt(i); attrsOS.write(attr.getData()); } diff --git a/base/util/src/com/netscape/cmsutil/scep/CRSPKIMessage.java b/base/util/src/com/netscape/cmsutil/scep/CRSPKIMessage.java index aef8de0b7..baf66e710 100644 --- a/base/util/src/com/netscape/cmsutil/scep/CRSPKIMessage.java +++ b/base/util/src/com/netscape/cmsutil/scep/CRSPKIMessage.java @@ -712,7 +712,7 @@ public class CRSPKIMessage { sd = (SignedData) sdt.decode( new ByteArrayInputStream( - ((ANY) crsci.getContent()).getEncoded() + crsci.getContent().getEncoded() )); this.decodeSD(); } @@ -736,19 +736,19 @@ public class CRSPKIMessage { sdci = sd.getContentInfo(); // HACK to work with CRS - ANY a = (ANY) sdci.getContent(); + ANY a = sdci.getContent(); ByteArrayInputStream s = new ByteArrayInputStream(a.getEncoded()); OCTET_STRING os = (OCTET_STRING) (new OCTET_STRING.Template()).decode(s); ByteArrayInputStream s2 = new ByteArrayInputStream(os.toByteArray()); ContentInfo ci = (ContentInfo) (new ContentInfo.Template()).decode(s2); - ByteArrayInputStream s3 = new ByteArrayInputStream(((ANY) ci.getContent()).getEncoded()); + ByteArrayInputStream s3 = new ByteArrayInputStream(ci.getContent().getEncoded()); EnvelopedData.Template edt = new EnvelopedData.Template(); sded = (EnvelopedData) edt.decode(s3); - SET signerCerts = (SET) sd.getCertificates(); + SET signerCerts = sd.getCertificates(); Certificate firstCert = (Certificate) signerCerts.elementAt(0); signerCertBytes = ASN1Util.encode(firstCert); @@ -777,7 +777,7 @@ public class CRSPKIMessage { private void decodeED() throws Exception { SET ris; - ris = (SET) sded.getRecipientInfos(); + ris = sded.getRecipientInfos(); if (ris.size() == 0) { throw new Exception("RecipientInfos is empty"); @@ -842,7 +842,7 @@ public class CRSPKIMessage { for (count = 0; count < aa.size(); count++) { Attribute a = (Attribute) aa.elementAt(count); - SET s = (SET) a.getValues(); + SET s = a.getValues(); ANY f = (ANY) s.elementAt(0); PrintableString ps; PrintableString.Template pst = new PrintableString.Template(); diff --git a/base/util/src/com/netscape/cmsutil/util/Utils.java b/base/util/src/com/netscape/cmsutil/util/Utils.java index bfd1e5297..75e63f2b0 100644 --- a/base/util/src/com/netscape/cmsutil/util/Utils.java +++ b/base/util/src/com/netscape/cmsutil/util/Utils.java @@ -98,7 +98,7 @@ public class Utils { ByteArrayOutputStream out = new ByteArrayOutputStream(s.length()); for (int i = 0; i < s.length(); i++) { - int c = (int) s.charAt(i); + int c = s.charAt(i); if (c == '+') { out.write(' '); @@ -120,7 +120,7 @@ public class Utils { ByteArrayOutputStream out = new ByteArrayOutputStream(s.length()); for (int i = 0; i < s.length(); i++) { - int c = (int) s.charAt(i); + int c = s.charAt(i); if (c == '+') { out.write(' '); diff --git a/base/util/src/com/netscape/cmsutil/xml/XMLObject.java b/base/util/src/com/netscape/cmsutil/xml/XMLObject.java index ed2fb67ee..a7715ec99 100644 --- a/base/util/src/com/netscape/cmsutil/xml/XMLObject.java +++ b/base/util/src/com/netscape/cmsutil/xml/XMLObject.java @@ -77,7 +77,7 @@ public class XMLObject { public Node createRoot(String name) { Element root = mDoc.createElement(name); mDoc.appendChild(root); - return (Node) root; + return root; } public Node getRoot() { @@ -98,7 +98,7 @@ public class XMLObject { public Node createContainer(Node containerParent, String containerName) { Element node = mDoc.createElement(containerName); containerParent.appendChild(node); - return (Node) node; + return node; } public void addItemToContainer(Node container, String tagname, String value) { diff --git a/base/util/src/netscape/net/TransferProtocolClient.java b/base/util/src/netscape/net/TransferProtocolClient.java index 587ec85a1..93eb1e06e 100644 --- a/base/util/src/netscape/net/TransferProtocolClient.java +++ b/base/util/src/netscape/net/TransferProtocolClient.java @@ -108,7 +108,7 @@ public class TransferProtocolClient extends NetworkClient { /** converts the server response into a string. */ public String getResponseString() { - return (String) serverResponse.elementAt(0); + return serverResponse.elementAt(0); } /** Returns all server response strings. */ diff --git a/base/util/src/netscape/security/acl/AclEntryImpl.java b/base/util/src/netscape/security/acl/AclEntryImpl.java index 878eacb68..790da68f4 100644 --- a/base/util/src/netscape/security/acl/AclEntryImpl.java +++ b/base/util/src/netscape/security/acl/AclEntryImpl.java @@ -152,7 +152,7 @@ public class AclEntryImpl implements AclEntry { s.append(user + "="); Enumeration<Permission> e = permissions(); while (e.hasMoreElements()) { - Permission p = (Permission) e.nextElement(); + Permission p = e.nextElement(); s.append(p); if (e.hasMoreElements()) s.append(","); diff --git a/base/util/src/netscape/security/acl/AclImpl.java b/base/util/src/netscape/security/acl/AclImpl.java index 75ff02083..884304301 100644 --- a/base/util/src/netscape/security/acl/AclImpl.java +++ b/base/util/src/netscape/security/acl/AclImpl.java @@ -220,7 +220,7 @@ public class AclImpl extends OwnerImpl implements Acl { public boolean checkPermission(Principal principal, Permission permission) { Enumeration<Permission> permSet = getPermissions(principal); while (permSet.hasMoreElements()) { - Permission p = (Permission) permSet.nextElement(); + Permission p = permSet.nextElement(); if (p.equals(permission)) return true; } @@ -244,7 +244,7 @@ public class AclImpl extends OwnerImpl implements Acl { StringBuffer sb = new StringBuffer(); Enumeration<AclEntry> entries = entries(); while (entries.hasMoreElements()) { - AclEntry entry = (AclEntry) entries.nextElement(); + AclEntry entry = entries.nextElement(); sb.append(entry.toString().trim()); sb.append("\n"); } @@ -319,7 +319,7 @@ public class AclImpl extends OwnerImpl implements Acl { while (e.hasMoreElements()) { Group g = (Group) e.nextElement(); if (g.isMember(user)) { - AclEntry ae = (AclEntry) allowedGroupsTable.get(g); + AclEntry ae = allowedGroupsTable.get(g); groupPositive = union(ae.permissions(), groupPositive); } } @@ -332,7 +332,7 @@ public class AclImpl extends OwnerImpl implements Acl { while (e.hasMoreElements()) { Group g = (Group) e.nextElement(); if (g.isMember(user)) { - AclEntry ae = (AclEntry) deniedGroupsTable.get(g); + AclEntry ae = deniedGroupsTable.get(g); groupNegative = union(ae.permissions(), groupNegative); } } @@ -341,7 +341,7 @@ public class AclImpl extends OwnerImpl implements Acl { private Enumeration<Permission> getIndividualPositive(Principal user) { Enumeration<Permission> individualPositive = zeroSet.elements(); - AclEntry ae = (AclEntry) allowedUsersTable.get(user); + AclEntry ae = allowedUsersTable.get(user); if (ae != null) individualPositive = ae.permissions(); return individualPositive; @@ -349,7 +349,7 @@ public class AclImpl extends OwnerImpl implements Acl { private Enumeration<Permission> getIndividualNegative(Principal user) { Enumeration<Permission> individualNegative = zeroSet.elements(); - AclEntry ae = (AclEntry) deniedUsersTable.get(user); + AclEntry ae = deniedUsersTable.get(user); if (ae != null) individualNegative = ae.permissions(); return individualNegative; diff --git a/base/util/src/netscape/security/extensions/AuthInfoAccessExtension.java b/base/util/src/netscape/security/extensions/AuthInfoAccessExtension.java index 13f8007ed..c3d2bec6c 100644 --- a/base/util/src/netscape/security/extensions/AuthInfoAccessExtension.java +++ b/base/util/src/netscape/security/extensions/AuthInfoAccessExtension.java @@ -98,7 +98,7 @@ public class AuthInfoAccessExtension extends Extension implements CertAttrSet { throws IOException { this.extensionId = ID; this.critical = critical.booleanValue(); - this.extensionValue = (byte[]) ((byte[]) value).clone(); + this.extensionValue = ((byte[]) value).clone(); decodeThis(); } diff --git a/base/util/src/netscape/security/extensions/CertificateRenewalWindowExtension.java b/base/util/src/netscape/security/extensions/CertificateRenewalWindowExtension.java index f659cd1ad..141959451 100644 --- a/base/util/src/netscape/security/extensions/CertificateRenewalWindowExtension.java +++ b/base/util/src/netscape/security/extensions/CertificateRenewalWindowExtension.java @@ -70,7 +70,7 @@ public class CertificateRenewalWindowExtension extends Extension throws IOException { this.extensionId = ID; this.critical = critical.booleanValue(); - this.extensionValue = (byte[]) ((byte[]) value).clone(); + this.extensionValue = ((byte[]) value).clone(); decodeThis(); } diff --git a/base/util/src/netscape/security/extensions/CertificateScopeOfUseExtension.java b/base/util/src/netscape/security/extensions/CertificateScopeOfUseExtension.java index 7055ad9d1..271bd3606 100644 --- a/base/util/src/netscape/security/extensions/CertificateScopeOfUseExtension.java +++ b/base/util/src/netscape/security/extensions/CertificateScopeOfUseExtension.java @@ -83,7 +83,7 @@ public class CertificateScopeOfUseExtension extends Extension throws IOException { this.extensionId = ID; this.critical = critical.booleanValue(); - this.extensionValue = (byte[]) ((byte[]) value).clone(); + this.extensionValue = ((byte[]) value).clone(); decodeThis(); } @@ -154,8 +154,7 @@ public class CertificateScopeOfUseExtension extends Extension throw new IOException("Invalid Scope Entries"); for (int i = 0; i < mEntries.size(); i++) { - CertificateScopeEntry se = (CertificateScopeEntry) - mEntries.elementAt(i); + CertificateScopeEntry se = mEntries.elementAt(i); se.encode(tmp); } @@ -188,8 +187,7 @@ public class CertificateScopeOfUseExtension extends Extension if (mEntries != null) { for (int i = 0; i < mEntries.size(); i++) { - CertificateScopeEntry se = (CertificateScopeEntry) - mEntries.elementAt(i); + CertificateScopeEntry se = mEntries.elementAt(i); s += se.toString(); } diff --git a/base/util/src/netscape/security/extensions/ExtendedKeyUsageExtension.java b/base/util/src/netscape/security/extensions/ExtendedKeyUsageExtension.java index 939da036f..072a7c974 100644 --- a/base/util/src/netscape/security/extensions/ExtendedKeyUsageExtension.java +++ b/base/util/src/netscape/security/extensions/ExtendedKeyUsageExtension.java @@ -89,7 +89,7 @@ public class ExtendedKeyUsageExtension extends Extension implements CertAttrSet throws IOException { extensionId = ObjectIdentifier.getObjectIdentifier(OID); critical = crit.booleanValue(); - extensionValue = (byte[]) ((byte[]) byteVal).clone(); + extensionValue = ((byte[]) byteVal).clone(); decodeThis(); } @@ -209,7 +209,7 @@ public class ExtendedKeyUsageExtension extends Extension implements CertAttrSet try { while (oidList.hasMoreElements()) { - temp.putOID((ObjectIdentifier) oidList.nextElement()); + temp.putOID(oidList.nextElement()); } } catch (IOException ex) { ex.printStackTrace(); diff --git a/base/util/src/netscape/security/extensions/GenericASN1Extension.java b/base/util/src/netscape/security/extensions/GenericASN1Extension.java index 778f9cdf5..d6bd01223 100644 --- a/base/util/src/netscape/security/extensions/GenericASN1Extension.java +++ b/base/util/src/netscape/security/extensions/GenericASN1Extension.java @@ -104,55 +104,55 @@ public class GenericASN1Extension extends Extension os.write(DerValue.tag_Sequence, tmp); return os.toByteArray(); default: - type = (String) mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_TYPE); + type = mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_TYPE); if (type.equalsIgnoreCase("integer")) { - int num = Integer.parseInt((String) mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_VALUE)); + int num = Integer.parseInt(mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_VALUE)); PutInteger(tmp, num); } else if (type.equalsIgnoreCase("ia5string")) { - source = (String) mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_SOURCE); - value = (String) mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_VALUE); + source = mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_SOURCE); + value = mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_VALUE); if (source.equalsIgnoreCase("file")) PutIA5String(tmp, getFromFile(value)); else PutIA5String(tmp, value); } else if (type.equalsIgnoreCase("octetstring")) { - source = (String) mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_SOURCE); - value = (String) mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_VALUE); + source = mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_SOURCE); + value = mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_VALUE); // It should be colon seperated ASCII Hexdecimal String if (source.equalsIgnoreCase("file")) PutOctetString(tmp, getFromFile(value)); else PutOctetString(tmp, value); } else if (type.equalsIgnoreCase("bmpstring")) { - source = (String) mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_SOURCE); - value = (String) mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_VALUE); + source = mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_SOURCE); + value = mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_VALUE); if (source.equalsIgnoreCase("file")) PutBMPString(tmp, getFromFile(value)); else PutBMPString(tmp, value); } else if (type.equalsIgnoreCase("printablestring")) { - source = (String) mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_SOURCE); - value = (String) mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_VALUE); + source = mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_SOURCE); + value = mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_VALUE); if (source.equalsIgnoreCase("file")) PutPrintableString(tmp, getFromFile(value)); else PutPrintableString(tmp, value); } else if (type.equalsIgnoreCase("visiblestring")) { - source = (String) mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_SOURCE); - value = (String) mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_VALUE); + source = mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_SOURCE); + value = mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_VALUE); if (source.equalsIgnoreCase("file")) PutVisibleString(tmp, getFromFile(value)); else PutVisibleString(tmp, value); } else if (type.equalsIgnoreCase("utctime")) { - value = (String) mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_VALUE); + value = mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_VALUE); PutUTCtime(tmp, value); } else if (type.equalsIgnoreCase("oid")) { - value = (String) mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_VALUE); + value = mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_VALUE); PutOID(tmp, value); } else if (type.equalsIgnoreCase("boolean")) { boolean bool = false; - String b = (String) mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_VALUE); + String b = mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_VALUE); if (b.equalsIgnoreCase("true")) bool = true; else @@ -205,10 +205,10 @@ public class GenericASN1Extension extends Extension public GenericASN1Extension(Hashtable<String, String> config) throws IOException, ParseException { mConfig = config; - ObjectIdentifier tmpid = new ObjectIdentifier((String) mConfig.get(PROP_OID)); - name = (String) mConfig.get(PROP_NAME); - OID = (String) mConfig.get(PROP_OID); - pattern = (String) mConfig.get(PROP_PATTERN); + ObjectIdentifier tmpid = new ObjectIdentifier(mConfig.get(PROP_OID)); + name = mConfig.get(PROP_NAME); + OID = mConfig.get(PROP_OID); + pattern = mConfig.get(PROP_PATTERN); try { if (OIDMap.getName(tmpid) == null) @@ -218,7 +218,7 @@ public class GenericASN1Extension extends Extension this.extensionId = tmpid; this.critical = false; - String b = (String) mConfig.get(PROP_CRITICAL); + String b = mConfig.get(PROP_CRITICAL); if (b.equalsIgnoreCase("true")) this.critical = true; else @@ -428,14 +428,14 @@ public class GenericASN1Extension extends Extension } for (i = 0, j = 0; j < s.length(); j++) { - int ch = (int) s.charAt(j); + int ch = s.charAt(j); if (ch == 10 || ch == 13 || ch == 9) continue; i++; } buff = new byte[i]; for (i = 0, j = 0; j < s.length(); j++) { - int ch = (int) s.charAt(j); + int ch = s.charAt(j); if (ch == 10 || ch == 13 || ch == 9) continue; buff[i++] = (byte) ch; diff --git a/base/util/src/netscape/security/extensions/KerberosName.java b/base/util/src/netscape/security/extensions/KerberosName.java index cf1ddc0a8..a10d70b40 100644 --- a/base/util/src/netscape/security/extensions/KerberosName.java +++ b/base/util/src/netscape/security/extensions/KerberosName.java @@ -86,7 +86,7 @@ public class KerberosName { DerOutputStream name_strings = new DerOutputStream(); DerOutputStream name_string = new DerOutputStream(); for (int i = 0; i < m_name_strings.size(); i++) { - name_string.putGeneralString((String) m_name_strings.elementAt(i)); + name_string.putGeneralString(m_name_strings.elementAt(i)); } name_strings.write(DerValue.tag_SequenceOf, name_string); tmp1.write(DerValue.createTag(DerValue.TAG_CONTEXT, @@ -109,10 +109,10 @@ public class KerberosName { String strings = null; for (int i = 0; i < m_name_strings.size(); i++) { if (strings == null) { - strings = (String) m_name_strings.elementAt(i); + strings = m_name_strings.elementAt(i); } else { strings += ","; - strings += (String) m_name_strings.elementAt(i); + strings += m_name_strings.elementAt(i); } } return "Realm: " + m_realm + " Name Type: " + m_name_type + " Name String(s):" + strings; diff --git a/base/util/src/netscape/security/extensions/NSCertTypeExtension.java b/base/util/src/netscape/security/extensions/NSCertTypeExtension.java index 9865cde0a..f14d113c7 100644 --- a/base/util/src/netscape/security/extensions/NSCertTypeExtension.java +++ b/base/util/src/netscape/security/extensions/NSCertTypeExtension.java @@ -237,7 +237,7 @@ public class NSCertTypeExtension extends Extension implements CertAttrSet { this.extensionId = CertType_Id; this.critical = critical.booleanValue(); - byte[] extValue = (byte[]) ((byte[]) value).clone(); + byte[] extValue = ((byte[]) value).clone(); this.extensionValue = extValue; DerValue val = new DerValue(extValue); diff --git a/base/util/src/netscape/security/extensions/OCSPNoCheckExtension.java b/base/util/src/netscape/security/extensions/OCSPNoCheckExtension.java index 28da8085f..bd6cf5aa7 100644 --- a/base/util/src/netscape/security/extensions/OCSPNoCheckExtension.java +++ b/base/util/src/netscape/security/extensions/OCSPNoCheckExtension.java @@ -78,7 +78,7 @@ public class OCSPNoCheckExtension extends Extension implements CertAttrSet { // never here } critical = crit.booleanValue(); - extensionValue = (byte[]) ((byte[]) byteVal).clone(); + extensionValue = ((byte[]) byteVal).clone(); } public void setCritical(boolean newValue) { diff --git a/base/util/src/netscape/security/extensions/PresenceServerExtension.java b/base/util/src/netscape/security/extensions/PresenceServerExtension.java index c67fe9965..1e78ecc94 100644 --- a/base/util/src/netscape/security/extensions/PresenceServerExtension.java +++ b/base/util/src/netscape/security/extensions/PresenceServerExtension.java @@ -62,7 +62,7 @@ public class PresenceServerExtension extends Extension implements CertAttrSet { throws IOException { this.extensionId = new ObjectIdentifier(OID); this.critical = critical.booleanValue(); - this.extensionValue = (byte[]) ((byte[]) value).clone(); + this.extensionValue = ((byte[]) value).clone(); decodeThis(); } diff --git a/base/util/src/netscape/security/extensions/SubjectInfoAccessExtension.java b/base/util/src/netscape/security/extensions/SubjectInfoAccessExtension.java index 6bd5c95b6..b11c77634 100644 --- a/base/util/src/netscape/security/extensions/SubjectInfoAccessExtension.java +++ b/base/util/src/netscape/security/extensions/SubjectInfoAccessExtension.java @@ -80,7 +80,7 @@ public class SubjectInfoAccessExtension extends Extension implements CertAttrSet throws IOException { this.extensionId = ID; this.critical = critical.booleanValue(); - this.extensionValue = (byte[]) ((byte[]) value).clone(); + this.extensionValue = ((byte[]) value).clone(); decodeThis(); } diff --git a/base/util/src/netscape/security/pkcs/PKCS10Attribute.java b/base/util/src/netscape/security/pkcs/PKCS10Attribute.java index eae4b0479..3a2c7b437 100644 --- a/base/util/src/netscape/security/pkcs/PKCS10Attribute.java +++ b/base/util/src/netscape/security/pkcs/PKCS10Attribute.java @@ -105,8 +105,7 @@ public class PKCS10Attribute implements DerEncoder, Serializable { //DerValue dv = inAttrValue.data.getDerValue(); // hack. toDerInputStream only gives one extension. DerInputStream fi = new DerInputStream(inAttrValue.toByteArray()); - attributeValue = (CertAttrSet) new - Extensions(fi); + attributeValue = new Extensions(fi); //CertificateExtensions(fi); return; } catch (Exception e) { @@ -119,7 +118,7 @@ public class PKCS10Attribute implements DerEncoder, Serializable { @SuppressWarnings("unchecked") Class<CertAttrSet> extClass = (Class<CertAttrSet>) OIDMap.getClass(attributeId); if (extClass != null) { - Constructor<CertAttrSet> cons = (Constructor<CertAttrSet>) extClass.getConstructor(params); + Constructor<CertAttrSet> cons = extClass.getConstructor(params); Object value = Array.newInstance(byte.class, val.length); for (int i = 0; i < val.length; i++) { Array.setByte(value, i, val[i]); diff --git a/base/util/src/netscape/security/pkcs/PKCS7.java b/base/util/src/netscape/security/pkcs/PKCS7.java index 26a0bdb34..8bd514099 100644 --- a/base/util/src/netscape/security/pkcs/PKCS7.java +++ b/base/util/src/netscape/security/pkcs/PKCS7.java @@ -191,7 +191,7 @@ public class PKCS7 { for (int i = 0; i < len; i++) { try { - X509Certificate cert = (X509Certificate) new + X509Certificate cert = new X509CertImpl(certificateVals[i]); certificates[i] = cert; } catch (CertificateException e) { @@ -412,7 +412,7 @@ public class PKCS7 { for (int i = 0; i < certificates.length; i++) { X509Certificate cert = certificates[i]; X500Name thisName = (X500Name) cert.getIssuerDN(); - BigInteger tmpSerial = (BigInteger) cert.getSerialNumber(); + BigInteger tmpSerial = cert.getSerialNumber(); BigInt thisSerial = new BigInt(tmpSerial); if (serial.equals(thisSerial) && name.equals(thisName)) { return cert; diff --git a/base/util/src/netscape/security/pkcs/PKCS9Attribute.java b/base/util/src/netscape/security/pkcs/PKCS9Attribute.java index 1239ccaf3..398fc0174 100644 --- a/base/util/src/netscape/security/pkcs/PKCS9Attribute.java +++ b/base/util/src/netscape/security/pkcs/PKCS9Attribute.java @@ -1013,7 +1013,7 @@ public class PKCS9Attribute implements DerEncoder { * Return the name of this attribute. */ public String getName() { - return (String) OID_NAME_TABLE.get(PKCS9_OIDS[index]); + return OID_NAME_TABLE.get(PKCS9_OIDS[index]); } /** @@ -1021,7 +1021,7 @@ public class PKCS9Attribute implements DerEncoder { * the name. */ public static ObjectIdentifier getOID(String name) { - return (ObjectIdentifier) NAME_OID_TABLE.get(name.toLowerCase()); + return NAME_OID_TABLE.get(name.toLowerCase()); } /** @@ -1029,7 +1029,7 @@ public class PKCS9Attribute implements DerEncoder { * the oid. */ public static String getName(ObjectIdentifier oid) { - return (String) OID_NAME_TABLE.get(oid); + return OID_NAME_TABLE.get(oid); } /** diff --git a/base/util/src/netscape/security/pkcs/PKCS9Attributes.java b/base/util/src/netscape/security/pkcs/PKCS9Attributes.java index 39bf2340e..35996b4b6 100644 --- a/base/util/src/netscape/security/pkcs/PKCS9Attributes.java +++ b/base/util/src/netscape/security/pkcs/PKCS9Attributes.java @@ -204,7 +204,7 @@ public class PKCS9Attributes { * DerValue.tag_SetOf. */ public byte[] getDerEncoding() throws IOException { - return (byte[]) derEncoding.clone(); + return derEncoding.clone(); } diff --git a/base/util/src/netscape/security/provider/DSAKeyPairGenerator.java b/base/util/src/netscape/security/provider/DSAKeyPairGenerator.java index c0fc274a9..dca206d0c 100644 --- a/base/util/src/netscape/security/provider/DSAKeyPairGenerator.java +++ b/base/util/src/netscape/security/provider/DSAKeyPairGenerator.java @@ -273,9 +273,8 @@ public class DSAKeyPairGenerator extends KeyPairGenerator DSAParameterSpec dsaParamSpec; try { - dsaParamSpec = (DSAParameterSpec) - dsaParamGen.generateParameters().getParameterSpec - (DSAParameterSpec.class); + dsaParamSpec = dsaParamGen.generateParameters().getParameterSpec + (DSAParameterSpec.class); } catch (InvalidParameterSpecException e) { // this should never happen throw new RuntimeException(e.getMessage()); diff --git a/base/util/src/netscape/security/provider/DSAPrivateKey.java b/base/util/src/netscape/security/provider/DSAPrivateKey.java index d18206c1e..8b64fbf6c 100644 --- a/base/util/src/netscape/security/provider/DSAPrivateKey.java +++ b/base/util/src/netscape/security/provider/DSAPrivateKey.java @@ -94,14 +94,11 @@ public final class DSAPrivateKey extends PKCS8Key if (algid instanceof DSAParams) { return (DSAParams) algid; } else { - DSAParameterSpec paramSpec; AlgorithmParameters algParams = algid.getParameters(); if (algParams == null) { return null; } - paramSpec = (DSAParameterSpec) algParams.getParameterSpec - (DSAParameterSpec.class); - return (DSAParams) paramSpec; + return algParams.getParameterSpec(DSAParameterSpec.class); } } catch (InvalidParameterSpecException e) { return null; diff --git a/base/util/src/netscape/security/provider/DSAPublicKey.java b/base/util/src/netscape/security/provider/DSAPublicKey.java index 699a28261..66c3eb45a 100644 --- a/base/util/src/netscape/security/provider/DSAPublicKey.java +++ b/base/util/src/netscape/security/provider/DSAPublicKey.java @@ -99,9 +99,9 @@ public final class DSAPublicKey extends X509Key if (algParams == null) { return null; } - paramSpec = (DSAParameterSpec) algParams.getParameterSpec + paramSpec = algParams.getParameterSpec (DSAParameterSpec.class); - return (DSAParams) paramSpec; + return paramSpec; } } catch (InvalidParameterSpecException e) { return null; diff --git a/base/util/src/netscape/security/provider/MD5.java b/base/util/src/netscape/security/provider/MD5.java index 00d3a4c29..47b99eb1b 100644 --- a/base/util/src/netscape/security/provider/MD5.java +++ b/base/util/src/netscape/security/provider/MD5.java @@ -140,9 +140,9 @@ public final class MD5 extends MessageDigestSpi implements Cloneable { d = state[3]; for (int i = 0; i < 16; i++) { - x[i] = (int) buf[i * 4 + offset] & 0xff; + x[i] = buf[i * 4 + offset] & 0xff; for (int j = 1; j < 4; j++) { - x[i] += ((int) buf[i * 4 + j + offset] & 0xff) << (j * 8); + x[i] += (buf[i * 4 + j + offset] & 0xff) << (j * 8); } } @@ -365,10 +365,10 @@ public final class MD5 extends MessageDigestSpi implements Cloneable { MD5 that = null; try { that = (MD5) super.clone(); - that.state = (int[]) this.state.clone(); - that.transformBuffer = (int[]) this.transformBuffer.clone(); - that.buffer = (byte[]) this.buffer.clone(); - that.digestBits = (byte[]) this.digestBits.clone(); + that.state = this.state.clone(); + that.transformBuffer = this.transformBuffer.clone(); + that.buffer = this.buffer.clone(); + that.digestBits = this.digestBits.clone(); that.count = this.count; return that; } catch (CloneNotSupportedException e) { diff --git a/base/util/src/netscape/security/util/BigInt.java b/base/util/src/netscape/security/util/BigInt.java index aed24e7ad..1bf00684e 100644 --- a/base/util/src/netscape/security/util/BigInt.java +++ b/base/util/src/netscape/security/util/BigInt.java @@ -115,7 +115,7 @@ public final class BigInt { throw new NumberFormatException("BigInt.toInt, too big"); int retval = 0, i = 0; for (; i < places.length; i++) - retval = (retval << 8) + ((int) places[i] & 0xff); + retval = (retval << 8) + (places[i] & 0xff); return retval; } diff --git a/base/util/src/netscape/security/util/BitArray.java b/base/util/src/netscape/security/util/BitArray.java index e37de4eb5..9f51e255a 100644 --- a/base/util/src/netscape/security/util/BitArray.java +++ b/base/util/src/netscape/security/util/BitArray.java @@ -107,7 +107,7 @@ public class BitArray { */ private BitArray(BitArray ba) { length = ba.length; - repn = (byte[]) ba.repn.clone(); + repn = ba.repn.clone(); } /** @@ -156,7 +156,7 @@ public class BitArray { * is not a multiple of 8.) */ public byte[] toByteArray() { - return (byte[]) repn.clone(); + return repn.clone(); } public boolean equals(Object obj) { diff --git a/base/util/src/netscape/security/util/CertPrettyPrint.java b/base/util/src/netscape/security/util/CertPrettyPrint.java index 7dfbf1588..1d159aa9a 100644 --- a/base/util/src/netscape/security/util/CertPrettyPrint.java +++ b/base/util/src/netscape/security/util/CertPrettyPrint.java @@ -305,7 +305,7 @@ public class CertPrettyPrint { PrettyPrintResources.TOKEN_EXTENSIONS) + "\n"); if (extensions != null) for (int i = 0; i < extensions.size(); i++) { - Extension ext = (Extension) extensions.elementAt(i); + Extension ext = extensions.elementAt(i); ExtPrettyPrint extpp = new ExtPrettyPrint(ext, 16); sb.append(extpp.toString()); diff --git a/base/util/src/netscape/security/util/CrlPrettyPrint.java b/base/util/src/netscape/security/util/CrlPrettyPrint.java index 77c1e196f..39230f91d 100644 --- a/base/util/src/netscape/security/util/CrlPrettyPrint.java +++ b/base/util/src/netscape/security/util/CrlPrettyPrint.java @@ -223,7 +223,7 @@ public class CrlPrettyPrint { if (crlExtensions != null) { for (int k = 0; k < crlExtensions.size(); k++) { - Extension ext = (Extension) crlExtensions.elementAt(k); + Extension ext = crlExtensions.elementAt(k); ExtPrettyPrint extpp = new ExtPrettyPrint(ext, 20); sb.append(extpp.toString()); @@ -242,7 +242,7 @@ public class CrlPrettyPrint { sb.append(pp.indent(8) + resource.getString( PrettyPrintResources.TOKEN_EXTENSIONS) + "\n"); for (int k = 0; k < crlExtensions.size(); k++) { - Extension ext = (Extension) crlExtensions.elementAt(k); + Extension ext = crlExtensions.elementAt(k); ExtPrettyPrint extpp = new ExtPrettyPrint(ext, 12); sb.append(extpp.toString()); diff --git a/base/util/src/netscape/security/util/DerInputStream.java b/base/util/src/netscape/security/util/DerInputStream.java index 7508f81b9..b8c1c8c93 100644 --- a/base/util/src/netscape/security/util/DerInputStream.java +++ b/base/util/src/netscape/security/util/DerInputStream.java @@ -332,7 +332,7 @@ public class DerInputStream { DerValue[] retval = new DerValue[max]; for (i = 0; i < max; i++) - retval[i] = (DerValue) vec.elementAt(i); + retval[i] = vec.elementAt(i); return retval; } diff --git a/base/util/src/netscape/security/util/ExtPrettyPrint.java b/base/util/src/netscape/security/util/ExtPrettyPrint.java index c0e9050ea..c69f70ebc 100644 --- a/base/util/src/netscape/security/util/ExtPrettyPrint.java +++ b/base/util/src/netscape/security/util/ExtPrettyPrint.java @@ -349,8 +349,7 @@ public class ExtPrettyPrint { SubjectInfoAccessExtension aia = (SubjectInfoAccessExtension) mExt; for (int i = 0; i < aia.numberOfAccessDescription(); i++) { - AccessDescription ad = (AccessDescription) - aia.getAccessDescription(i); + AccessDescription ad = aia.getAccessDescription(i); ObjectIdentifier method = ad.getMethod(); if (method.equals(SubjectInfoAccessExtension.METHOD_OCSP)) { @@ -391,8 +390,7 @@ public class ExtPrettyPrint { AuthInfoAccessExtension aia = (AuthInfoAccessExtension) mExt; for (int i = 0; i < aia.numberOfAccessDescription(); i++) { - AccessDescription ad = (AccessDescription) - aia.getAccessDescription(i); + AccessDescription ad = aia.getAccessDescription(i); ObjectIdentifier method = ad.getMethod(); if (method.equals(AuthInfoAccessExtension.METHOD_OCSP)) { @@ -508,7 +506,7 @@ public class ExtPrettyPrint { if (e != null) { while (e.hasMoreElements()) { - ObjectIdentifier oid = (ObjectIdentifier) e.nextElement(); + ObjectIdentifier oid = e.nextElement(); if (oid.equals(ExtendedKeyUsageExtension.OID_OCSP_SIGNING)) { sb.append(pp.indent(mIndentSize + 8) + "OCSPSigning" + "\n"); @@ -721,7 +719,7 @@ public class ExtPrettyPrint { sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_CRITICAL)); CRLReasonExtension ext = (CRLReasonExtension) mExt; - if (((Extension) mExt).isCritical()) { + if (mExt.isCritical()) { sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n"); } else { sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n"); @@ -749,7 +747,7 @@ public class ExtPrettyPrint { sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_CRITICAL)); InhibitAnyPolicyExtension ext = (InhibitAnyPolicyExtension) mExt; - if (((Extension) mExt).isCritical()) + if (mExt.isCritical()) sb.append(mResource.getString( PrettyPrintResources.TOKEN_YES) + "\n"); else @@ -778,7 +776,7 @@ public class ExtPrettyPrint { sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_CRITICAL)); BasicConstraintsExtension ext = (BasicConstraintsExtension) mExt; - if (((Extension) mExt).isCritical()) { + if (mExt.isCritical()) { sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n"); } else { sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n"); @@ -826,7 +824,7 @@ public class ExtPrettyPrint { sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_CRITICAL)); CRLNumberExtension ext = (CRLNumberExtension) mExt; - if (((Extension) mExt).isCritical()) { + if (mExt.isCritical()) { sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n"); } else { sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n"); @@ -858,7 +856,7 @@ public class ExtPrettyPrint { sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_CRITICAL)); DeltaCRLIndicatorExtension ext = (DeltaCRLIndicatorExtension) mExt; - if (((Extension) mExt).isCritical()) { + if (mExt.isCritical()) { sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n"); } else { sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n"); @@ -890,7 +888,7 @@ public class ExtPrettyPrint { sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_CRITICAL)); IssuerAlternativeNameExtension ext = (IssuerAlternativeNameExtension) mExt; - if (((Extension) mExt).isCritical()) { + if (mExt.isCritical()) { sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n"); } else { sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n"); @@ -933,7 +931,7 @@ public class ExtPrettyPrint { sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_CRITICAL)); SubjectAlternativeNameExtension ext = (SubjectAlternativeNameExtension) mExt; - if (((Extension) mExt).isCritical()) { + if (mExt.isCritical()) { sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n"); } else { sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n"); @@ -984,7 +982,7 @@ public class ExtPrettyPrint { sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_SCOPE_OF_USE) + "\n"); for (int i = 0; i < entries.size(); i++) { - CertificateScopeEntry se = (CertificateScopeEntry) entries.elementAt(i); + CertificateScopeEntry se = entries.elementAt(i); GeneralName gn = se.getGeneralName(); if (gn != null) { @@ -1026,7 +1024,7 @@ public class ExtPrettyPrint { mExt.getExtensionId().toString() + "\n"); sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_CRITICAL)); - if (((Extension) mExt).isCritical()) { + if (mExt.isCritical()) { sb.append(mResource.getString( PrettyPrintResources.TOKEN_YES) + "\n"); } else { @@ -1125,7 +1123,7 @@ public class ExtPrettyPrint { mExt.getExtensionId().toString() + "\n"); sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_CRITICAL)); - if (((Extension) mExt).isCritical()) { + if (mExt.isCritical()) { sb.append(mResource.getString( PrettyPrintResources.TOKEN_YES) + "\n"); } else { @@ -1236,7 +1234,7 @@ public class ExtPrettyPrint { sb.append(mResource.getString(PrettyPrintResources.TOKEN_ISSUING_DIST_POINT) + "- " + mExt.getExtensionId().toString() + "\n"); sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_CRITICAL)); - if (((Extension) mExt).isCritical()) { + if (mExt.isCritical()) { sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n"); } else { sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n"); @@ -1320,7 +1318,7 @@ public class ExtPrettyPrint { PrettyPrintResources.TOKEN_CRITICAL)); InvalidityDateExtension ext = (InvalidityDateExtension) mExt; - if (((Extension) mExt).isCritical()) { + if (mExt.isCritical()) { sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n"); } else { sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n"); @@ -1349,7 +1347,7 @@ public class ExtPrettyPrint { PrettyPrintResources.TOKEN_CRITICAL)); CertificateIssuerExtension ext = (CertificateIssuerExtension) mExt; - if (((Extension) mExt).isCritical()) { + if (mExt.isCritical()) { sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n"); } else { sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n"); @@ -1395,7 +1393,7 @@ public class ExtPrettyPrint { PrettyPrintResources.TOKEN_CRITICAL)); HoldInstructionExtension ext = (HoldInstructionExtension) mExt; - if (((Extension) mExt).isCritical()) { + if (mExt.isCritical()) { sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n"); } else { sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n"); @@ -1424,7 +1422,7 @@ public class ExtPrettyPrint { "- " + mExt.getExtensionId().toString() + "\n"); sb.append(pp.indent(mIndentSize + 4) + mResource.getString( PrettyPrintResources.TOKEN_CRITICAL)); - if (((Extension) mExt).isCritical()) { + if (mExt.isCritical()) { sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n"); } else { sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n"); @@ -1467,7 +1465,7 @@ public class ExtPrettyPrint { "- " + mExt.getExtensionId().toString() + "\n"); sb.append(pp.indent(mIndentSize + 4) + mResource.getString( PrettyPrintResources.TOKEN_CRITICAL)); - if (((Extension) mExt).isCritical()) { + if (mExt.isCritical()) { sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n"); } else { sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n"); @@ -1488,7 +1486,7 @@ public class ExtPrettyPrint { mResource.getString( PrettyPrintResources.TOKEN_MAP) + i + ":" + "\n"); CertificatePolicyMap m = - (CertificatePolicyMap) maps.nextElement(); + maps.nextElement(); sb.append(pp.indent(mIndentSize + 12) + mResource.getString( @@ -1519,7 +1517,7 @@ public class ExtPrettyPrint { "- " + mExt.getExtensionId().toString() + "\n"); sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_CRITICAL)); - if (((Extension) mExt).isCritical()) { + if (mExt.isCritical()) { sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n"); } else { sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n"); @@ -1538,7 +1536,7 @@ public class ExtPrettyPrint { } else { sb.append("\n"); for (int j = 0; attrs.hasMoreElements(); j++) { - Attribute attr = (Attribute) attrs.nextElement(); + Attribute attr = attrs.nextElement(); sb.append(pp.indent(mIndentSize + 8) + mResource.getString( @@ -1557,7 +1555,7 @@ public class ExtPrettyPrint { PrettyPrintResources.TOKEN_NONE) + "\n"); } else { for (int k = 0; values.hasMoreElements(); k++) { - String v = (String) values.nextElement(); + String v = values.nextElement(); if (k != 0) sb.append(","); diff --git a/base/util/src/netscape/security/util/ObjectIdentifier.java b/base/util/src/netscape/security/util/ObjectIdentifier.java index a1d7b0a75..67846ec55 100644 --- a/base/util/src/netscape/security/util/ObjectIdentifier.java +++ b/base/util/src/netscape/security/util/ObjectIdentifier.java @@ -84,7 +84,7 @@ final public class ObjectIdentifier implements Serializable { */ public ObjectIdentifier(int values[]) { try { - components = (int[]) values.clone(); + components = values.clone(); componentLen = values.length; } catch (Throwable t) { System.out.println("X509.ObjectIdentifier(), no cloning!"); diff --git a/base/util/src/netscape/security/x509/CRLDistributionPointsExtension.java b/base/util/src/netscape/security/x509/CRLDistributionPointsExtension.java index 6ab962fae..327322b1c 100644 --- a/base/util/src/netscape/security/x509/CRLDistributionPointsExtension.java +++ b/base/util/src/netscape/security/x509/CRLDistributionPointsExtension.java @@ -85,7 +85,7 @@ public class CRLDistributionPointsExtension extends Extension this.extensionId = PKIXExtensions.CRLDistributionPoints_Id; this.critical = critical.booleanValue(); - this.extensionValue = (byte[]) ((byte[]) value).clone(); + this.extensionValue = ((byte[]) value).clone(); // decode the value try { diff --git a/base/util/src/netscape/security/x509/CRLExtensions.java b/base/util/src/netscape/security/x509/CRLExtensions.java index 4a567e173..3ebc72e41 100755 --- a/base/util/src/netscape/security/x509/CRLExtensions.java +++ b/base/util/src/netscape/security/x509/CRLExtensions.java @@ -198,7 +198,7 @@ public class CRLExtensions extends Vector<Extension> { name = alias.substring(index + 1); } else name = alias; - Extension ext = (Extension) map.get(name); + Extension ext = map.get(name); if (ext == null) throw new X509ExtensionException("No extension found with name: " + alias); diff --git a/base/util/src/netscape/security/x509/CRLReasonExtension.java b/base/util/src/netscape/security/x509/CRLReasonExtension.java index bd82ff2fc..6a5fd6295 100644 --- a/base/util/src/netscape/security/x509/CRLReasonExtension.java +++ b/base/util/src/netscape/security/x509/CRLReasonExtension.java @@ -113,7 +113,7 @@ public final class CRLReasonExtension extends Extension implements CertAttrSet { this.extensionId = PKIXExtensions.ReasonCode_Id; this.critical = critical.booleanValue(); - byte[] extValue = (byte[]) ((byte[]) value).clone(); + byte[] extValue = ((byte[]) value).clone(); this.extensionValue = extValue; DerValue val = new DerValue(extValue); int reasonCode = val.getEnumerated(); diff --git a/base/util/src/netscape/security/x509/CertAndKeyGen.java b/base/util/src/netscape/security/x509/CertAndKeyGen.java index 703585f36..d2a8f2b6f 100644 --- a/base/util/src/netscape/security/x509/CertAndKeyGen.java +++ b/base/util/src/netscape/security/x509/CertAndKeyGen.java @@ -234,7 +234,7 @@ public final class CertAndKeyGen { cert = new X509CertImpl(info); cert.sign(privateKey, algID.getName()); - return (X509Certificate) cert; + return cert; } catch (IOException e) { throw new CertificateEncodingException("getSelfCert: " + diff --git a/base/util/src/netscape/security/x509/CertificateChain.java b/base/util/src/netscape/security/x509/CertificateChain.java index 60df0ec65..346dcc740 100644 --- a/base/util/src/netscape/security/x509/CertificateChain.java +++ b/base/util/src/netscape/security/x509/CertificateChain.java @@ -47,7 +47,7 @@ public class CertificateChain implements Serializable { * @param chain a certificate array. */ public CertificateChain(X509Certificate[] chain) { - mChain = (X509Certificate[]) chain.clone(); + mChain = chain.clone(); } /** @@ -75,7 +75,7 @@ public class CertificateChain implements Serializable { * @return an array of X509 Certificates. */ public X509Certificate[] getChain() { - return (X509Certificate[]) mChain.clone(); + return mChain.clone(); } public void encode(OutputStream out) diff --git a/base/util/src/netscape/security/x509/CertificatePoliciesExtension.java b/base/util/src/netscape/security/x509/CertificatePoliciesExtension.java index 7fdd6ba02..8d45fd110 100644 --- a/base/util/src/netscape/security/x509/CertificatePoliciesExtension.java +++ b/base/util/src/netscape/security/x509/CertificatePoliciesExtension.java @@ -78,7 +78,7 @@ public class CertificatePoliciesExtension extends Extension DerOutputStream tmp = new DerOutputStream(); for (int i = 0; i < mInfos.size(); i++) { - ((CertificatePolicyInfo) mInfos.elementAt(i)).encode(tmp); + mInfos.elementAt(i).encode(tmp); } os.write(DerValue.tag_Sequence, tmp); extensionValue = os.toByteArray(); diff --git a/base/util/src/netscape/security/x509/CertificatePolicySet.java b/base/util/src/netscape/security/x509/CertificatePolicySet.java index 68a5e3139..7b6558df1 100644 --- a/base/util/src/netscape/security/x509/CertificatePolicySet.java +++ b/base/util/src/netscape/security/x509/CertificatePolicySet.java @@ -79,7 +79,7 @@ public class CertificatePolicySet { DerOutputStream tmp = new DerOutputStream(); for (int i = 0; i < ids.size(); i++) { - ((CertificatePolicyId) ids.elementAt(i)).encode(tmp); + ids.elementAt(i).encode(tmp); } out.write(DerValue.tag_Sequence, tmp); } diff --git a/base/util/src/netscape/security/x509/EDIPartyName.java b/base/util/src/netscape/security/x509/EDIPartyName.java index eac5c0953..def86ffa5 100644 --- a/base/util/src/netscape/security/x509/EDIPartyName.java +++ b/base/util/src/netscape/security/x509/EDIPartyName.java @@ -88,7 +88,7 @@ public class EDIPartyName implements GeneralNameInterface { for (int i = 0; i < len; i++) { DerValue opt = seq[i]; - if (opt.isContextSpecific((byte) TAG_ASSIGNER) && + if (opt.isContextSpecific(TAG_ASSIGNER) && !opt.isConstructed()) { if (assigner != null) throw new IOException("Duplicate nameAssigner found in" @@ -96,7 +96,7 @@ public class EDIPartyName implements GeneralNameInterface { opt = opt.data.getDerValue(); assigner = opt.getAsString(); } - if (opt.isContextSpecific((byte) TAG_PARTYNAME) && + if (opt.isContextSpecific(TAG_PARTYNAME) && !opt.isConstructed()) { if (party != null) throw new IOException("Duplicate partyName found in" diff --git a/base/util/src/netscape/security/x509/FreshestCRLExtension.java b/base/util/src/netscape/security/x509/FreshestCRLExtension.java index 8e32bed66..b27f01a61 100644 --- a/base/util/src/netscape/security/x509/FreshestCRLExtension.java +++ b/base/util/src/netscape/security/x509/FreshestCRLExtension.java @@ -105,7 +105,7 @@ public class FreshestCRLExtension extends Extension try { this.extensionId = PKIXExtensions.FreshestCRL_Id; this.critical = critical.booleanValue(); - this.extensionValue = (byte[]) ((byte[]) value).clone(); + this.extensionValue = ((byte[]) value).clone(); // decode the value try { @@ -363,7 +363,7 @@ public class FreshestCRLExtension extends Extension int size = list.size(); 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); diff --git a/base/util/src/netscape/security/x509/GeneralSubtrees.java b/base/util/src/netscape/security/x509/GeneralSubtrees.java index 0c3c64cb2..720b6b225 100644 --- a/base/util/src/netscape/security/x509/GeneralSubtrees.java +++ b/base/util/src/netscape/security/x509/GeneralSubtrees.java @@ -79,7 +79,7 @@ public class GeneralSubtrees { GeneralSubtree element; for (Enumeration<GeneralSubtree> e = trees.elements(); e.hasMoreElements();) { - element = (GeneralSubtree) e.nextElement(); + element = e.nextElement(); s = s + pp.indent(indent + 4) + element.toPrint(indent) + "\n"; } @@ -95,7 +95,7 @@ public class GeneralSubtrees { DerOutputStream seq = new DerOutputStream(); for (int i = 0; i < trees.size(); i++) { - ((GeneralSubtree) trees.elementAt(i)).encode(seq); + trees.elementAt(i).encode(seq); } out.write(DerValue.tag_Sequence, seq); } diff --git a/base/util/src/netscape/security/x509/IssuingDistributionPointExtension.java b/base/util/src/netscape/security/x509/IssuingDistributionPointExtension.java index bcbaa2e3d..b1cf61180 100644 --- a/base/util/src/netscape/security/x509/IssuingDistributionPointExtension.java +++ b/base/util/src/netscape/security/x509/IssuingDistributionPointExtension.java @@ -131,7 +131,7 @@ public class IssuingDistributionPointExtension extends Extension this.extensionId = PKIXExtensions.IssuingDistributionPoint_Id; this.critical = critical.booleanValue(); - this.extensionValue = (byte[]) ((byte[]) value).clone(); + this.extensionValue = ((byte[]) value).clone(); byte[] extValue = this.extensionValue; issuingDistributionPoint = new IssuingDistributionPoint(); diff --git a/base/util/src/netscape/security/x509/KeyIdentifier.java b/base/util/src/netscape/security/x509/KeyIdentifier.java index c3d16030e..643e86a31 100644 --- a/base/util/src/netscape/security/x509/KeyIdentifier.java +++ b/base/util/src/netscape/security/x509/KeyIdentifier.java @@ -58,7 +58,7 @@ public class KeyIdentifier implements java.io.Serializable { * Return the value of the KeyIdentifier as byte array. */ public byte[] getIdentifier() { - return ((byte[]) octetString.clone()); + return octetString.clone(); } /** diff --git a/base/util/src/netscape/security/x509/KeyUsageExtension.java b/base/util/src/netscape/security/x509/KeyUsageExtension.java index 52cac0265..d116c4def 100644 --- a/base/util/src/netscape/security/x509/KeyUsageExtension.java +++ b/base/util/src/netscape/security/x509/KeyUsageExtension.java @@ -402,7 +402,7 @@ public class KeyUsageExtension extends Extension } public boolean[] getBits() { - return (boolean[]) bitString.clone(); + return bitString.clone(); } /** diff --git a/base/util/src/netscape/security/x509/LdapV3DNStrConverter.java b/base/util/src/netscape/security/x509/LdapV3DNStrConverter.java index f01da74ec..68bbeb2ad 100644 --- a/base/util/src/netscape/security/x509/LdapV3DNStrConverter.java +++ b/base/util/src/netscape/security/x509/LdapV3DNStrConverter.java @@ -198,7 +198,7 @@ public class LdapV3DNStrConverter extends LdapDNStrConverter { names = new RDN[rdnVector.size()]; for (i = 0, j = rdnVector.size() - 1; i < rdnVector.size(); i++, j--) - names[j] = (RDN) rdnVector.elementAt(i); + names[j] = rdnVector.elementAt(i); return new X500Name(names); } @@ -242,7 +242,7 @@ public class LdapV3DNStrConverter extends LdapDNStrConverter { assertion = new AVA[avaVector.size()]; for (int i = 0; i < avaVector.size(); i++) - assertion[i] = (AVA) avaVector.elementAt(i); + assertion[i] = avaVector.elementAt(i); return new RDN(assertion); } @@ -376,7 +376,7 @@ public class LdapV3DNStrConverter extends LdapDNStrConverter { "expecting escaped char."); if (hexDigits.indexOf((char) c) == -1) { in.unread(c); - in.unread((int) '\\'); + in.unread('\\'); break; } } while (true); diff --git a/base/util/src/netscape/security/x509/OIDMap.java b/base/util/src/netscape/security/x509/OIDMap.java index 41c1fa289..17573a019 100644 --- a/base/util/src/netscape/security/x509/OIDMap.java +++ b/base/util/src/netscape/security/x509/OIDMap.java @@ -245,7 +245,7 @@ public class OIDMap { * is registered for this oid. */ public static String getName(ObjectIdentifier oid) { - return (String) oid2Name.get(oid); + return oid2Name.get(oid); } /** @@ -256,7 +256,7 @@ public class OIDMap { * is registered for this name. */ public static ObjectIdentifier getOID(String name) { - return (ObjectIdentifier) name2OID.get(name); + return name2OID.get(name); } /** @@ -266,7 +266,7 @@ public class OIDMap { * @exception CertificateException if class cannot be instantiated. */ public static Class<?> getClass(String name) throws CertificateException { - String className = (String) name2Class.get(name); + String className = name2Class.get(name); if (className == null) return null; try { @@ -289,7 +289,7 @@ public class OIDMap { String name = getName(oid); if (name == null) return null; - String className = (String) name2Class.get(name); + String className = name2Class.get(name); if (className == null) return null; try { diff --git a/base/util/src/netscape/security/x509/OtherName.java b/base/util/src/netscape/security/x509/OtherName.java index b2533ecbb..ae8398344 100644 --- a/base/util/src/netscape/security/x509/OtherName.java +++ b/base/util/src/netscape/security/x509/OtherName.java @@ -201,7 +201,7 @@ public class OtherName implements GeneralNameInterface { if ((data[i] & 0xff) < 16) { b.append("0"); } - b.append(Integer.toString((int) (data[i] & 0xff), 0x10)); + b.append(Integer.toString((data[i] & 0xff), 0x10)); } return b.toString(); } diff --git a/base/util/src/netscape/security/x509/PolicyMappingsExtension.java b/base/util/src/netscape/security/x509/PolicyMappingsExtension.java index bb782ea52..458e32d4a 100644 --- a/base/util/src/netscape/security/x509/PolicyMappingsExtension.java +++ b/base/util/src/netscape/security/x509/PolicyMappingsExtension.java @@ -73,7 +73,7 @@ public class PolicyMappingsExtension extends Extension DerOutputStream tmp = new DerOutputStream(); for (int i = 0; i < maps.size(); i++) { - ((CertificatePolicyMap) maps.elementAt(i)).encode(tmp); + maps.elementAt(i).encode(tmp); } os.write(DerValue.tag_Sequence, tmp); extensionValue = os.toByteArray(); diff --git a/base/util/src/netscape/security/x509/PrivateKeyUsageExtension.java b/base/util/src/netscape/security/x509/PrivateKeyUsageExtension.java index 5544fdb75..80af3d1c4 100644 --- a/base/util/src/netscape/security/x509/PrivateKeyUsageExtension.java +++ b/base/util/src/netscape/security/x509/PrivateKeyUsageExtension.java @@ -149,7 +149,7 @@ public class PrivateKeyUsageExtension extends Extension for (int i = 0; i < seq.length; i++) { DerValue opt = seq[i]; - if (opt.isContextSpecific((byte) TAG_BEFORE) && + if (opt.isContextSpecific(TAG_BEFORE) && !opt.isConstructed()) { if (notBefore != null) { throw new CertificateParsingException( @@ -159,7 +159,7 @@ public class PrivateKeyUsageExtension extends Extension str = new DerInputStream(opt.toByteArray()); notBefore = str.getGeneralizedTime(); - } else if (opt.isContextSpecific((byte) TAG_AFTER) && + } else if (opt.isContextSpecific(TAG_AFTER) && !opt.isConstructed()) { if (notAfter != null) { throw new CertificateParsingException( diff --git a/base/util/src/netscape/security/x509/RDN.java b/base/util/src/netscape/security/x509/RDN.java index 6a4e7e1a9..dc26eb214 100644 --- a/base/util/src/netscape/security/x509/RDN.java +++ b/base/util/src/netscape/security/x509/RDN.java @@ -147,7 +147,7 @@ public class RDN { * @param avas a AVA Array. */ public RDN(AVA avas[]) { - assertion = (AVA[]) avas.clone(); + assertion = avas.clone(); } /** @@ -167,7 +167,7 @@ public class RDN { * @return array of AVA in this RDN. */ public AVA[] getAssertion() { - return (AVA[]) assertion.clone(); + return assertion.clone(); } /** diff --git a/base/util/src/netscape/security/x509/RevokedCertImpl.java b/base/util/src/netscape/security/x509/RevokedCertImpl.java index 45aa78920..866f1c0d9 100755 --- a/base/util/src/netscape/security/x509/RevokedCertImpl.java +++ b/base/util/src/netscape/security/x509/RevokedCertImpl.java @@ -29,7 +29,6 @@ import java.util.Enumeration; import java.util.LinkedHashSet; import java.util.Set; -import netscape.security.util.BigInt; import netscape.security.util.DerInputStream; import netscape.security.util.DerOutputStream; import netscape.security.util.DerValue; @@ -255,7 +254,7 @@ public class RevokedCertImpl extends RevokedCertificate implements Serializable * @return the serial number. */ public BigInteger getSerialNumber() { - return ((BigInt) serialNumber.getNumber()).toBigInteger(); + return serialNumber.getNumber().toBigInteger(); } /** @@ -290,7 +289,7 @@ public class RevokedCertImpl extends RevokedCertificate implements Serializable sb.append("\n"); for (int i = 0; i < extensions.size(); i++) sb.append("Entry Extension[" + i + "]: " - + ((Extension) (extensions.elementAt(i))).toString()); + + (extensions.elementAt(i)).toString()); } sb.append("\n"); return (sb.toString()); diff --git a/base/util/src/netscape/security/x509/X500Name.java b/base/util/src/netscape/security/x509/X500Name.java index abffbe7b1..c2886dab2 100644 --- a/base/util/src/netscape/security/x509/X500Name.java +++ b/base/util/src/netscape/security/x509/X500Name.java @@ -268,7 +268,7 @@ public class X500Name implements Principal, GeneralNameInterface { */ public X500Name(RDN[] rdns) throws IOException { - names = (RDN[]) rdns.clone(); + names = rdns.clone(); } /** @@ -281,7 +281,7 @@ public class X500Name implements Principal, GeneralNameInterface { int size = rdnVector.size(); names = new RDN[size]; for (int i = 0; i < size; i++) { - names[i] = (RDN) rdnVector.elementAt(i); + names[i] = rdnVector.elementAt(i); } } @@ -525,7 +525,7 @@ public class X500Name implements Principal, GeneralNameInterface { * @return array of RDN in this X500name. */ public RDN[] getNames() { - return (RDN[]) names.clone(); + return names.clone(); } /** diff --git a/base/util/src/netscape/security/x509/X500NameAttrMap.java b/base/util/src/netscape/security/x509/X500NameAttrMap.java index 8821c5e71..3947f0990 100644 --- a/base/util/src/netscape/security/x509/X500NameAttrMap.java +++ b/base/util/src/netscape/security/x509/X500NameAttrMap.java @@ -85,7 +85,7 @@ public class X500NameAttrMap { name2OID.get(name.toUpperCase()); if (oid == null) return null; - return (AVAValueConverter) oid2ValueConverter.get(oid); + return oid2ValueConverter.get(oid); } /** @@ -96,7 +96,7 @@ public class X500NameAttrMap { * @return An AVAValueConverter for the OID. */ public AVAValueConverter getValueConverter(ObjectIdentifier oid) { - return (AVAValueConverter) oid2ValueConverter.get(oid); + return oid2ValueConverter.get(oid); } /** diff --git a/base/util/src/netscape/security/x509/X509CRLImpl.java b/base/util/src/netscape/security/x509/X509CRLImpl.java index 05afe2653..9725db640 100755 --- a/base/util/src/netscape/security/x509/X509CRLImpl.java +++ b/base/util/src/netscape/security/x509/X509CRLImpl.java @@ -516,23 +516,22 @@ public class X509CRLImpl extends X509CRL { public String toString() { StringBuffer sb = new StringBuffer(); sb.append("X.509 CRL v" + (version + 1) + "\n"); - sb.append("Signature Algorithm: " + sigAlgId.toString() + - ", OID=" + (sigAlgId.getOID()).toString() + "\n"); - sb.append("Issuer: " + issuer.toString() + "\n"); - sb.append("\nThis Update: " + thisUpdate.toString() + "\n"); + sb.append("Signature Algorithm: " + sigAlgId + + ", OID=" + sigAlgId.getOID() + "\n"); + sb.append("Issuer: " + issuer + "\n"); + sb.append("\nThis Update: " + thisUpdate + "\n"); if (nextUpdate != null) - sb.append("Next Update: " + nextUpdate.toString() + "\n"); + sb.append("Next Update: " + nextUpdate + "\n"); if (revokedCerts.isEmpty()) sb.append("\nNO certificates have been revoked\n"); else { sb.append("\nRevoked Certificates:\n"); for (Enumeration<RevokedCertificate> e = revokedCerts.elements(); e.hasMoreElements();) - sb.append(((RevokedCertificate) e.nextElement()).toString()); + sb.append(e.nextElement()); } if (extensions != null) { for (int i = 0; i < extensions.size(); i++) { - sb.append("\nCRL Extension[" + i + "]: " + - ((Extension) (extensions.elementAt(i))).toString()); + sb.append("\nCRL Extension[" + i + "]: " + extensions.elementAt(i)); } } netscape.security.util.PrettyPrintFormat pp = @@ -614,7 +613,7 @@ public class X509CRLImpl extends X509CRL { * @return the issuer name. */ public Principal getIssuerDN() { - return (Principal) issuer; + return issuer; } /** @@ -650,9 +649,7 @@ public class X509CRLImpl extends X509CRL { public X509CRLEntry getRevokedCertificate(BigInteger serialNumber) { if (revokedCerts == null || revokedCerts.isEmpty()) return null; - RevokedCertificate badCert = - (RevokedCertificate) revokedCerts.get(serialNumber); - return badCert; + return revokedCerts.get(serialNumber); } /** @@ -806,7 +803,7 @@ public class X509CRLImpl extends X509CRL { for (Enumeration<Extension> e = extensions.getElements(); e.hasMoreElements();) { ex = e.nextElement(); if (ex.isCritical()) { - extSet.add(((ObjectIdentifier) ex.getExtensionId()).toString()); + extSet.add(ex.getExtensionId().toString()); } } return extSet; @@ -827,7 +824,7 @@ public class X509CRLImpl extends X509CRL { for (Enumeration<Extension> e = extensions.getElements(); e.hasMoreElements();) { ex = e.nextElement(); if (!ex.isCritical()) - extSet.add(((ObjectIdentifier) ex.getExtensionId()).toString()); + extSet.add(ex.getExtensionId().toString()); } return extSet; } @@ -884,7 +881,7 @@ public class X509CRLImpl extends X509CRL { return null; Enumeration<Extension> e = exts.getElements(); while (e.hasMoreElements()) { - Extension ext = (Extension) e.nextElement(); + Extension ext = e.nextElement(); if (ext instanceof CRLNumberExtension) { CRLNumberExtension numExt = (CRLNumberExtension) ext; return (BigInteger) numExt.get(CRLNumberExtension.NUMBER); @@ -902,7 +899,7 @@ public class X509CRLImpl extends X509CRL { return null; Enumeration<Extension> e = exts.getElements(); while (e.hasMoreElements()) { - Extension ext = (Extension) e.nextElement(); + Extension ext = e.nextElement(); if (ext instanceof DeltaCRLIndicatorExtension) { DeltaCRLIndicatorExtension numExt = (DeltaCRLIndicatorExtension) ext; return (BigInteger) numExt.get(DeltaCRLIndicatorExtension.NUMBER); @@ -920,7 +917,7 @@ public class X509CRLImpl extends X509CRL { return false; Enumeration<Extension> e = exts.getElements(); while (e.hasMoreElements()) { - Extension ext = (Extension) e.nextElement(); + Extension ext = e.nextElement(); if (ext instanceof DeltaCRLIndicatorExtension) { return true; } @@ -1049,7 +1046,7 @@ public class X509CRLImpl extends X509CRL { " not supported in CRL v1 entries."); revokedCerts.put(entry.getSerialNumber(), - (RevokedCertificate) entry); + entry); } } else { derStrm.skipSequence(4); diff --git a/base/util/src/netscape/security/x509/X509Cert.java b/base/util/src/netscape/security/x509/X509Cert.java index 5b6036049..9162cc92f 100644 --- a/base/util/src/netscape/security/x509/X509Cert.java +++ b/base/util/src/netscape/security/x509/X509Cert.java @@ -403,7 +403,7 @@ public class X509Cert implements Certificate, Serializable { Signature sig; if (privateKey instanceof Key) { - Key key = (Key) privateKey; + Key key = privateKey; algorithm = key.getAlgorithm(); } else { throw new InvalidKeyException("private key not a key!"); diff --git a/base/util/src/netscape/security/x509/X509CertImpl.java b/base/util/src/netscape/security/x509/X509CertImpl.java index f93fb9009..26b88fe3d 100755 --- a/base/util/src/netscape/security/x509/X509CertImpl.java +++ b/base/util/src/netscape/security/x509/X509CertImpl.java @@ -45,7 +45,6 @@ import java.util.LinkedHashSet; import java.util.Set; import java.util.Vector; -import netscape.security.util.BigInt; import netscape.security.util.DerEncoder; import netscape.security.util.DerOutputStream; import netscape.security.util.DerValue; @@ -707,7 +706,7 @@ public class X509CertImpl extends X509Certificate SerialNumber ser = (SerialNumber) info.get( CertificateSerialNumber.NAME + DOT + CertificateSerialNumber.NUMBER); - return ((BigInt) ser.getNumber()).toBigInteger(); + return ser.getNumber().toBigInteger(); } catch (Exception e) { return null; } @@ -915,7 +914,7 @@ public class X509CertImpl extends X509Certificate for (Enumeration<Extension> e = exts.getAttributes(); e.hasMoreElements();) { ex = e.nextElement(); if (ex.isCritical()) - extSet.add(((ObjectIdentifier) ex.getExtensionId()).toString()); + extSet.add(ex.getExtensionId().toString()); } return extSet; } catch (Exception e) { @@ -944,7 +943,7 @@ public class X509CertImpl extends X509Certificate for (Enumeration<Extension> e = exts.getAttributes(); e.hasMoreElements();) { ex = e.nextElement(); if (!ex.isCritical()) - extSet.add(((ObjectIdentifier) ex.getExtensionId()).toString()); + extSet.add(ex.getExtensionId().toString()); } return extSet; } catch (Exception e) { diff --git a/base/util/src/netscape/security/x509/X509CertInfo.java b/base/util/src/netscape/security/x509/X509CertInfo.java index 20ef2bd6a..314c3ad2b 100644 --- a/base/util/src/netscape/security/x509/X509CertInfo.java +++ b/base/util/src/netscape/security/x509/X509CertInfo.java @@ -356,7 +356,7 @@ public class X509CertInfo implements CertAttrSet, Serializable { new netscape.security.util.PrettyPrintFormat(" ", 20); for (int i = 0; i < extensions.size(); i++) { sb.append(" Extension[" + i + "] = "); - Extension ext = (Extension) extensions.elementAt(i); + Extension ext = extensions.elementAt(i); try { if (OIDMap.getClass(ext.getExtensionId()) == null) { sb.append(ext.toString()); |