8022444: Remove sun.security.util.ObjectIdentifier.equals(ObjectIdentifier other) method
Reviewed-by: mullan
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/OAEPParameters.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/OAEPParameters.java Mon Jun 29 16:36:44 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -121,7 +121,7 @@
} else if (data.isContextSpecific((byte) 0x01)) {
// mgf algid
AlgorithmId val = AlgorithmId.parse(data.data.getDerValue());
- if (!val.getOID().equals((Object) OID_MGF1)) {
+ if (!val.getOID().equals(OID_MGF1)) {
throw new IOException("Only MGF1 mgf is supported");
}
AlgorithmId params = AlgorithmId.parse(
@@ -144,7 +144,7 @@
} else if (data.isContextSpecific((byte) 0x02)) {
// pSource algid
AlgorithmId val = AlgorithmId.parse(data.data.getDerValue());
- if (!val.getOID().equals((Object) OID_PSpecified)) {
+ if (!val.getOID().equals(OID_PSpecified)) {
throw new IOException("Wrong OID for pSpecified");
}
DerInputStream dis = new DerInputStream(val.getEncodedParams());
--- a/jdk/src/java.base/share/classes/java/security/cert/X509CertSelector.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/security/cert/X509CertSelector.java Mon Jun 29 16:36:44 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -2238,7 +2238,7 @@
+ subjectPublicKeyAlgID + ", xcert subjectPublicKeyAlgID = "
+ algID.getOID());
}
- if (!subjectPublicKeyAlgID.equals((Object)algID.getOID())) {
+ if (!subjectPublicKeyAlgID.equals(algID.getOID())) {
if (debug != null) {
debug.println("X509CertSelector.match: "
+ "subject public key alg IDs don't match");
--- a/jdk/src/java.base/share/classes/sun/security/pkcs/ContentInfo.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/pkcs/ContentInfo.java Mon Jun 29 16:36:44 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -163,9 +163,9 @@
}
public byte[] getData() throws IOException {
- if (contentType.equals((Object)DATA_OID) ||
- contentType.equals((Object)OLD_DATA_OID) ||
- contentType.equals((Object)TIMESTAMP_TOKEN_INFO_OID)) {
+ if (contentType.equals(DATA_OID) ||
+ contentType.equals(OLD_DATA_OID) ||
+ contentType.equals(TIMESTAMP_TOKEN_INFO_OID)) {
if (content == null)
return null;
else
--- a/jdk/src/java.base/share/classes/sun/security/pkcs/PKCS7.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/pkcs/PKCS7.java Mon Jun 29 16:36:44 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -182,13 +182,12 @@
contentType = contentInfo.contentType;
DerValue content = contentInfo.getContent();
- if (contentType.equals((Object)ContentInfo.SIGNED_DATA_OID)) {
+ if (contentType.equals(ContentInfo.SIGNED_DATA_OID)) {
parseSignedData(content);
- } else if (contentType.equals((Object)ContentInfo.OLD_SIGNED_DATA_OID)) {
+ } else if (contentType.equals(ContentInfo.OLD_SIGNED_DATA_OID)) {
// This is for backwards compatibility with JDK 1.1.x
parseOldSignedData(content);
- } else if (contentType.equals((Object)
- ContentInfo.NETSCAPE_CERT_SEQUENCE_OID)){
+ } else if (contentType.equals(ContentInfo.NETSCAPE_CERT_SEQUENCE_OID)){
parseNetscapeCertChain(content);
} else {
throw new ParsingException("content type " + contentType +
--- a/jdk/src/java.base/share/classes/sun/security/pkcs/SignerInfo.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/pkcs/SignerInfo.java Mon Jun 29 16:36:44 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -307,7 +307,7 @@
authenticatedAttributes.getAttributeValue(
PKCS9Attribute.CONTENT_TYPE_OID);
if (contentType == null ||
- !contentType.equals((Object)content.contentType))
+ !contentType.equals(content.contentType))
return null; // contentType does not match, bad SignerInfo
// now, check message digest
--- a/jdk/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java Mon Jun 29 16:36:44 2015 -0700
@@ -789,7 +789,7 @@
}
}
if (params != null) {
- if (algorithm.equals((Object)pbes2_OID)) {
+ if (algorithm.equals(pbes2_OID)) {
algParams = AlgorithmParameters.getInstance("PBES2");
} else {
algParams = AlgorithmParameters.getInstance("PBE");
@@ -926,7 +926,7 @@
private static String mapPBEParamsToAlgorithm(ObjectIdentifier algorithm,
AlgorithmParameters algParams) throws NoSuchAlgorithmException {
// Check for PBES2 algorithms
- if (algorithm.equals((Object)pbes2_OID) && algParams != null) {
+ if (algorithm.equals(pbes2_OID) && algParams != null) {
return algParams.toString();
}
return algorithm.toString();
@@ -1937,7 +1937,7 @@
ContentInfo authSafe = new ContentInfo(s);
ObjectIdentifier contentType = authSafe.getContentType();
- if (contentType.equals((Object)ContentInfo.DATA_OID)) {
+ if (contentType.equals(ContentInfo.DATA_OID)) {
authSafeData = authSafe.getData();
} else /* signed data */ {
throw new IOException("public key protected PKCS12 not supported");
@@ -1965,14 +1965,14 @@
safeContents = new ContentInfo(sci);
contentType = safeContents.getContentType();
safeContentsData = null;
- if (contentType.equals((Object)ContentInfo.DATA_OID)) {
+ if (contentType.equals(ContentInfo.DATA_OID)) {
if (debug != null) {
debug.println("Loading PKCS#7 data content-type");
}
safeContentsData = safeContents.getData();
- } else if (contentType.equals((Object)ContentInfo.ENCRYPTED_DATA_OID)) {
+ } else if (contentType.equals(ContentInfo.ENCRYPTED_DATA_OID)) {
if (password == null) {
if (debug != null) {
@@ -2178,12 +2178,12 @@
+ bagValue.tag);
}
bagValue = bagValue.data.getDerValue();
- if (bagId.equals((Object)PKCS8ShroudedKeyBag_OID)) {
+ if (bagId.equals(PKCS8ShroudedKeyBag_OID)) {
PrivateKeyEntry kEntry = new PrivateKeyEntry();
kEntry.protectedPrivKey = bagValue.toByteArray();
bagItem = kEntry;
privateKeyCount++;
- } else if (bagId.equals((Object)CertBag_OID)) {
+ } else if (bagId.equals(CertBag_OID)) {
DerInputStream cs = new DerInputStream(bagValue.toByteArray());
DerValue[] certValues = cs.getSequence(2);
ObjectIdentifier certId = certValues[0].getOID();
@@ -2198,7 +2198,7 @@
(new ByteArrayInputStream(certValue.getOctetString()));
bagItem = cert;
certificateCount++;
- } else if (bagId.equals((Object)SecretBag_OID)) {
+ } else if (bagId.equals(SecretBag_OID)) {
DerInputStream ss = new DerInputStream(bagValue.toByteArray());
DerValue[] secretValues = ss.getSequence(2);
ObjectIdentifier secretId = secretValues[0].getOID();
@@ -2249,12 +2249,12 @@
throw new IOException("Attribute " + attrId +
" should have a value " + e.getMessage());
}
- if (attrId.equals((Object)PKCS9FriendlyName_OID)) {
+ if (attrId.equals(PKCS9FriendlyName_OID)) {
alias = valSet[0].getBMPString();
- } else if (attrId.equals((Object)PKCS9LocalKeyId_OID)) {
+ } else if (attrId.equals(PKCS9LocalKeyId_OID)) {
keyId = valSet[0].getOctetString();
} else if
- (attrId.equals((Object)TrustedKeyUsage_OID)) {
+ (attrId.equals(TrustedKeyUsage_OID)) {
trustedKeyUsage = new ObjectIdentifier[valSet.length];
for (int k = 0; k < valSet.length; k++) {
trustedKeyUsage[k] = valSet[k].getOID();
--- a/jdk/src/java.base/share/classes/sun/security/provider/certpath/OCSP.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/provider/certpath/OCSP.java Mon Jun 29 16:36:44 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -322,7 +322,7 @@
List<AccessDescription> descriptions = aia.getAccessDescriptions();
for (AccessDescription description : descriptions) {
- if (description.getAccessMethod().equals((Object)
+ if (description.getAccessMethod().equals(
AccessDescription.Ad_OCSP_Id)) {
GeneralName generalName = description.getAccessLocation();
--- a/jdk/src/java.base/share/classes/sun/security/provider/certpath/OCSPResponse.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/provider/certpath/OCSPResponse.java Mon Jun 29 16:36:44 2015 -0700
@@ -239,7 +239,7 @@
// responseType
derIn = tmp.data;
ObjectIdentifier responseType = derIn.getOID();
- if (responseType.equals((Object)OCSP_BASIC_RESPONSE_OID)) {
+ if (responseType.equals(OCSP_BASIC_RESPONSE_OID)) {
if (debug != null) {
debug.println("OCSP response type: basic");
}
@@ -338,8 +338,7 @@
debug.println("OCSP extension: " + ext);
}
// Only the NONCE extension is recognized
- if (ext.getExtensionId().equals((Object)
- OCSP.NONCE_EXTENSION_OID))
+ if (ext.getExtensionId().equals(OCSP.NONCE_EXTENSION_OID))
{
nonce = ext.getExtensionValue();
} else if (ext.isCritical()) {
--- a/jdk/src/java.base/share/classes/sun/security/provider/certpath/URICertStore.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/provider/certpath/URICertStore.java Mon Jun 29 16:36:44 2015 -0700
@@ -202,7 +202,7 @@
* object of a certificate's Authority Information Access Extension.
*/
static CertStore getInstance(AccessDescription ad) {
- if (!ad.getAccessMethod().equals((Object)
+ if (!ad.getAccessMethod().equals(
AccessDescription.Ad_CAISSUERS_Id)) {
return null;
}
--- a/jdk/src/java.base/share/classes/sun/security/rsa/RSASignature.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/rsa/RSASignature.java Mon Jun 29 16:36:44 2015 -0700
@@ -232,7 +232,7 @@
throw new IOException("SEQUENCE length error");
}
AlgorithmId algId = AlgorithmId.parse(values[0]);
- if (algId.getOID().equals((Object)oid) == false) {
+ if (algId.getOID().equals(oid) == false) {
throw new IOException("ObjectIdentifier mismatch: "
+ algId.getOID());
}
--- a/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java Mon Jun 29 16:36:44 2015 -0700
@@ -1280,7 +1280,7 @@
Iterator<PKCS10Attribute> attrs = req.getAttributes().getAttributes().iterator();
while (attrs.hasNext()) {
PKCS10Attribute attr = attrs.next();
- if (attr.getAttributeId().equals((Object)PKCS9Attribute.EXTENSION_REQUEST_OID)) {
+ if (attr.getAttributeId().equals(PKCS9Attribute.EXTENSION_REQUEST_OID)) {
reqex = (CertificateExtensions)attr.getAttributeValue();
}
}
@@ -2338,7 +2338,7 @@
req.getSubjectName(), pkey.getFormat(), pkey.getAlgorithm());
for (PKCS10Attribute attr: req.getAttributes().getAttributes()) {
ObjectIdentifier oid = attr.getAttributeId();
- if (oid.equals((Object)PKCS9Attribute.EXTENSION_REQUEST_OID)) {
+ if (oid.equals(PKCS9Attribute.EXTENSION_REQUEST_OID)) {
CertificateExtensions exts = (CertificateExtensions)attr.getAttributeValue();
if (exts != null) {
printExtensions(rb.getString("Extension.Request."), exts, out);
--- a/jdk/src/java.base/share/classes/sun/security/util/ObjectIdentifier.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/util/ObjectIdentifier.java Mon Jun 29 16:36:44 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -319,14 +319,6 @@
}
/**
- * @deprecated Use equals((Object)oid)
- */
- @Deprecated
- public boolean equals(ObjectIdentifier other) {
- return equals((Object)other);
- }
-
- /**
* Compares this identifier with another, for equality.
*
* @return true iff the names are identical.
--- a/jdk/src/java.base/share/classes/sun/security/x509/AVA.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/x509/AVA.java Mon Jun 29 16:36:44 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -364,8 +364,8 @@
// encode as PrintableString unless value contains
// non-PrintableString chars
- if (this.oid.equals((Object)PKCS9Attribute.EMAIL_ADDRESS_OID) ||
- (this.oid.equals((Object)X500Name.DOMAIN_COMPONENT_OID) &&
+ if (this.oid.equals(PKCS9Attribute.EMAIL_ADDRESS_OID) ||
+ (this.oid.equals(X500Name.DOMAIN_COMPONENT_OID) &&
PRESERVE_OLD_DC_ENCODING == false)) {
// EmailAddress and DomainComponent must be IA5String
return new DerValue(DerValue.tag_IA5String,
@@ -495,8 +495,8 @@
// encode as PrintableString unless value contains
// non-PrintableString chars
- if (this.oid.equals((Object)PKCS9Attribute.EMAIL_ADDRESS_OID) ||
- (this.oid.equals((Object)X500Name.DOMAIN_COMPONENT_OID) &&
+ if (this.oid.equals(PKCS9Attribute.EMAIL_ADDRESS_OID) ||
+ (this.oid.equals(X500Name.DOMAIN_COMPONENT_OID) &&
PRESERVE_OLD_DC_ENCODING == false)) {
// EmailAddress and DomainComponent must be IA5String
return new DerValue(DerValue.tag_IA5String, temp.toString());
--- a/jdk/src/java.base/share/classes/sun/security/x509/AccessDescription.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/x509/AccessDescription.java Mon Jun 29 16:36:44 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -95,19 +95,19 @@
if (this == that) {
return true;
}
- return (accessMethod.equals((Object)that.getAccessMethod()) &&
+ return (accessMethod.equals(that.getAccessMethod()) &&
accessLocation.equals(that.getAccessLocation()));
}
public String toString() {
String method = null;
- if (accessMethod.equals((Object)Ad_CAISSUERS_Id)) {
+ if (accessMethod.equals(Ad_CAISSUERS_Id)) {
method = "caIssuers";
- } else if (accessMethod.equals((Object)Ad_CAREPOSITORY_Id)) {
+ } else if (accessMethod.equals(Ad_CAREPOSITORY_Id)) {
method = "caRepository";
- } else if (accessMethod.equals((Object)Ad_TIMESTAMPING_Id)) {
+ } else if (accessMethod.equals(Ad_TIMESTAMPING_Id)) {
method = "timeStamping";
- } else if (accessMethod.equals((Object)Ad_OCSP_Id)) {
+ } else if (accessMethod.equals(Ad_OCSP_Id)) {
method = "ocsp";
} else {
method = accessMethod.toString();
--- a/jdk/src/java.base/share/classes/sun/security/x509/CertificateExtensions.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/x509/CertificateExtensions.java Mon Jun 29 16:36:44 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -241,7 +241,7 @@
public String getNameByOid(ObjectIdentifier oid) throws IOException {
for (String name: map.keySet()) {
- if (map.get(name).getExtensionId().equals((Object)oid)) {
+ if (map.get(name).getExtensionId().equals(oid)) {
return name;
}
}
--- a/jdk/src/java.base/share/classes/sun/security/x509/CertificatePolicyId.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/x509/CertificatePolicyId.java Mon Jun 29 16:36:44 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -93,8 +93,7 @@
*/
public boolean equals(Object other) {
if (other instanceof CertificatePolicyId)
- return id.equals((Object)
- ((CertificatePolicyId) other).getIdentifier());
+ return id.equals(((CertificatePolicyId) other).getIdentifier());
else
return false;
}
--- a/jdk/src/java.base/share/classes/sun/security/x509/Extension.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/x509/Extension.java Mon Jun 29 16:36:44 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -264,7 +264,7 @@
Extension otherExt = (Extension) other;
if (critical != otherExt.critical)
return false;
- if (!extensionId.equals((Object)otherExt.extensionId))
+ if (!extensionId.equals(otherExt.extensionId))
return false;
return Arrays.equals(extensionValue, otherExt.extensionValue);
}
--- a/jdk/src/java.base/share/classes/sun/security/x509/NameConstraintsExtension.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/x509/NameConstraintsExtension.java Mon Jun 29 16:36:44 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -579,7 +579,7 @@
public boolean verifyRFC822SpecialCase(X500Name subject) throws IOException {
for (AVA ava : subject.allAvas()) {
ObjectIdentifier attrOID = ava.getObjectIdentifier();
- if (attrOID.equals((Object)PKCS9Attribute.EMAIL_ADDRESS_OID)) {
+ if (attrOID.equals(PKCS9Attribute.EMAIL_ADDRESS_OID)) {
String attrValue = ava.getValueString();
if (attrValue != null) {
RFC822Name emailName;
--- a/jdk/src/java.base/share/classes/sun/security/x509/OIDName.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/x509/OIDName.java Mon Jun 29 16:36:44 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -120,7 +120,7 @@
OIDName other = (OIDName)obj;
- return oid.equals((Object)other.oid);
+ return oid.equals(other.oid);
}
/**
--- a/jdk/src/java.base/share/classes/sun/security/x509/OtherName.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/x509/OtherName.java Mon Jun 29 16:36:44 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -176,7 +176,7 @@
return false;
}
OtherName otherOther = (OtherName)other;
- if (!(otherOther.oid.equals((Object)oid))) {
+ if (!(otherOther.oid.equals(oid))) {
return false;
}
GeneralNameInterface otherGNI = null;
--- a/jdk/src/java.base/share/classes/sun/security/x509/RDN.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/x509/RDN.java Mon Jun 29 16:36:44 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -321,7 +321,7 @@
*/
DerValue findAttribute(ObjectIdentifier oid) {
for (int i = 0; i < assertion.length; i++) {
- if (assertion[i].oid.equals((Object)oid)) {
+ if (assertion[i].oid.equals(oid)) {
return assertion[i].value;
}
}
--- a/jdk/src/java.base/share/classes/sun/security/x509/X509CRLEntryImpl.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/x509/X509CRLEntryImpl.java Mon Jun 29 16:36:44 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -414,7 +414,7 @@
e.hasMoreElements();) {
ex = e.nextElement();
inCertOID = ex.getExtensionId();
- if (inCertOID.equals((Object)findOID)) {
+ if (inCertOID.equals(findOID)) {
crlExt = ex;
break;
}
--- a/jdk/src/java.base/share/classes/sun/security/x509/X509CRLImpl.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/x509/X509CRLImpl.java Mon Jun 29 16:36:44 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1039,7 +1039,7 @@
e.hasMoreElements();) {
ex = e.nextElement();
inCertOID = ex.getExtensionId();
- if (inCertOID.equals((Object)findOID)) {
+ if (inCertOID.equals(findOID)) {
crlExt = ex;
break;
}
--- a/jdk/src/java.base/share/classes/sun/security/x509/X509CertImpl.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/x509/X509CertImpl.java Mon Jun 29 16:36:44 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1339,7 +1339,7 @@
return ex;
}
for (Extension ex2: extensions.getAllExtensions()) {
- if (ex2.getExtensionId().equals((Object)oid)) {
+ if (ex2.getExtensionId().equals(oid)) {
//XXXX May want to consider cloning this
return ex2;
}
@@ -1395,7 +1395,7 @@
for (Extension ex : exts.getAllExtensions()) {
ObjectIdentifier inCertOID = ex.getExtensionId();
- if (inCertOID.equals((Object)findOID)) {
+ if (inCertOID.equals(findOID)) {
certExt = ex;
break;
}
--- a/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/Oid.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/Oid.java Mon Jun 29 16:36:44 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -157,7 +157,7 @@
return (true);
if (other instanceof Oid)
- return this.oid.equals((Object)((Oid) other).oid);
+ return this.oid.equals(((Oid) other).oid);
else if (other instanceof ObjectIdentifier)
return this.oid.equals(other);
else
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/GSSContextImpl.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/GSSContextImpl.java Mon Jun 29 16:36:44 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -252,7 +252,7 @@
} else {
// parse GSS header
gssHeader = new GSSHeader(inStream);
- if (!gssHeader.getOid().equals((Object) objId))
+ if (!gssHeader.getOid().equals(objId))
throw new GSSExceptionImpl
(GSSException.DEFECTIVE_TOKEN,
"Mechanism not equal to " +
@@ -346,7 +346,7 @@
} else {
// parse GSS Header
gssHeader = new GSSHeader(inStream);
- if (!gssHeader.getOid().equals((Object) objId))
+ if (!gssHeader.getOid().equals(objId))
throw new GSSExceptionImpl
(GSSException.DEFECTIVE_TOKEN,
"Mechanism not equal to " +
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/krb5/MessageToken.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/krb5/MessageToken.java Mon Jun 29 16:36:44 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -182,7 +182,7 @@
try {
gssHeader = new GSSHeader(is);
- if (!gssHeader.getOid().equals((Object)OID)) {
+ if (!gssHeader.getOid().equals(OID)) {
throw new GSSException(GSSException.DEFECTIVE_TOKEN, -1,
getTokenName(tokenId));
}
--- a/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/TimestampedSigner.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/TimestampedSigner.java Mon Jun 29 16:36:44 2015 -0700
@@ -169,7 +169,7 @@
for (int i = 0; i < derValue.length; i++) {
description = new AccessDescription(derValue[i]);
if (description.getAccessMethod()
- .equals((Object)AD_TIMESTAMPING_Id)) {
+ .equals(AD_TIMESTAMPING_Id)) {
location = description.getAccessLocation();
if (location.getType() == GeneralNameInterface.NAME_URI) {
uri = (URIName) location.getName();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/util/Oid/OidEquals.java Mon Jun 29 16:36:44 2015 -0700
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8022444
+ * @summary Test ObjectIdentifier.equals(Object obj)
+ */
+
+import sun.security.util.ObjectIdentifier;
+
+public class OidEquals {
+ public static void main(String[] args) throws Exception {
+ ObjectIdentifier oid1 = new ObjectIdentifier("1.3.6.1.4.1.42.2.17");
+ ObjectIdentifier oid2 =
+ new ObjectIdentifier(new int[]{1, 3, 6, 1, 4, 1, 42, 2, 17});
+ ObjectIdentifier oid3 = new ObjectIdentifier("1.2.3.4");
+
+ assertEquals(oid1, oid1);
+ assertEquals(oid1, oid2);
+ assertNotEquals(oid1, oid3);
+ assertNotEquals(oid1, "1.3.6.1.4.1.42.2.17");
+
+ System.out.println("Tests passed.");
+ }
+
+ static void assertEquals(ObjectIdentifier oid, Object obj)
+ throws Exception {
+ if (!oid.equals(obj)) {
+ throw new Exception("The ObjectIdentifier " + oid.toString() +
+ " should be equal to the Object " + obj.toString());
+ }
+ }
+
+ static void assertNotEquals(ObjectIdentifier oid, Object obj)
+ throws Exception {
+ if (oid.equals(obj)) {
+ throw new Exception("The ObjectIdentifier " + oid.toString() +
+ " should not be equal to the Object " + obj.toString());
+ }
+ }
+}
--- a/jdk/test/sun/security/util/Oid/OidFormat.java Mon Jun 29 14:59:20 2015 -0700
+++ b/jdk/test/sun/security/util/Oid/OidFormat.java Mon Jun 29 16:36:44 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -129,7 +129,7 @@
os.putOID(oid);
DerInputStream is = new DerInputStream(os.toByteArray());
ObjectIdentifier oid2 = is.getOID();
- if (!oid.equals((Object)oid2)) {
+ if (!oid.equals(oid2)) {
throw new Exception("Test DER I/O fails: " + oid + " and " + oid2);
}
}
@@ -144,7 +144,7 @@
os.putOID(oid);
DerInputStream is = new DerInputStream(os.toByteArray());
ObjectIdentifier oid2 = is.getOID();
- if (!oid.equals((Object)oid2)) {
+ if (!oid.equals(oid2)) {
throw new Exception("Test DER I/O fails: " + oid + " and " + oid2);
}
}