8022444: Remove sun.security.util.ObjectIdentifier.equals(ObjectIdentifier other) method

Reviewed-by: mullan
This commit is contained in:
Jason Uh 2015-06-29 16:36:44 -07:00
parent d67c81198b
commit 84ebc260b9
30 changed files with 140 additions and 89 deletions

View File

@ -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 @@ public final class OAEPParameters extends AlgorithmParametersSpi {
} 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 @@ public final class OAEPParameters extends AlgorithmParametersSpi {
} 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());

View File

@ -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 @@ public class X509CertSelector implements CertSelector {
+ 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");

View File

@ -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 class ContentInfo {
}
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

View File

@ -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 @@ public class PKCS7 {
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 +

View File

@ -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 @@ public class SignerInfo implements DerEncoder {
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

View File

@ -789,7 +789,7 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
}
}
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 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
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 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
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 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
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 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
+ 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 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
(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 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
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();

View File

@ -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 @@ public final class OCSP {
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();

View File

@ -239,7 +239,7 @@ public final class OCSPResponse {
// 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 @@ public final class OCSPResponse {
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()) {

View File

@ -202,7 +202,7 @@ class URICertStore extends CertStoreSpi {
* 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;
}

View File

@ -232,7 +232,7 @@ public abstract class RSASignature extends SignatureSpi {
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());
}

View File

@ -1280,7 +1280,7 @@ public final class Main {
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 @@ public final class Main {
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);

View File

@ -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
@ -318,14 +318,6 @@ class ObjectIdentifier implements Serializable
out.write (DerValue.tag_ObjectId, encoding);
}
/**
* @deprecated Use equals((Object)oid)
*/
@Deprecated
public boolean equals(ObjectIdentifier other) {
return equals((Object)other);
}
/**
* Compares this identifier with another, for equality.
*

View File

@ -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 @@ public class AVA implements DerEncoder {
// 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 @@ public class AVA implements DerEncoder {
// 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());

View File

@ -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 @@ public final class AccessDescription {
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();

View File

@ -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 class CertificateExtensions implements CertAttrSet<Extension> {
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;
}
}

View File

@ -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 class CertificatePolicyId {
*/
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;
}

View File

@ -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 @@ public class Extension implements java.security.cert.Extension {
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);
}

View File

@ -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 @@ implements CertAttrSet<String>, Cloneable {
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;

View File

@ -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 @@ public class OIDName implements GeneralNameInterface {
OIDName other = (OIDName)obj;
return oid.equals((Object)other.oid);
return oid.equals(other.oid);
}
/**

View File

@ -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 @@ public class OtherName implements GeneralNameInterface {
return false;
}
OtherName otherOther = (OtherName)other;
if (!(otherOther.oid.equals((Object)oid))) {
if (!(otherOther.oid.equals(oid))) {
return false;
}
GeneralNameInterface otherGNI = null;

View File

@ -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 @@ public class RDN {
*/
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;
}
}

View File

@ -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 @@ public class X509CRLEntryImpl extends X509CRLEntry
e.hasMoreElements();) {
ex = e.nextElement();
inCertOID = ex.getExtensionId();
if (inCertOID.equals((Object)findOID)) {
if (inCertOID.equals(findOID)) {
crlExt = ex;
break;
}

View File

@ -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 @@ public class X509CRLImpl extends X509CRL implements DerEncoder {
e.hasMoreElements();) {
ex = e.nextElement();
inCertOID = ex.getExtensionId();
if (inCertOID.equals((Object)findOID)) {
if (inCertOID.equals(findOID)) {
crlExt = ex;
break;
}

View File

@ -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 @@ public class X509CertImpl extends X509Certificate implements DerEncoder {
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 @@ public class X509CertImpl extends X509Certificate implements DerEncoder {
for (Extension ex : exts.getAllExtensions()) {
ObjectIdentifier inCertOID = ex.getExtensionId();
if (inCertOID.equals((Object)findOID)) {
if (inCertOID.equals(findOID)) {
certExt = ex;
break;
}

View File

@ -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 @@ public class Oid {
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

View File

@ -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 @@ public class GSSContextImpl implements GSSContext {
} 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 @@ public class GSSContextImpl implements GSSContext {
} 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 " +

View File

@ -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 @@ abstract class MessageToken extends Krb5Token {
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));
}

View File

@ -169,7 +169,7 @@ public final class TimestampedSigner extends ContentSigner {
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();

View File

@ -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());
}
}
}

View File

@ -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 @@ public class OidFormat {
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 @@ public class OidFormat {
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);
}
}