提交 7a9cbbb0 编写于 作者: D darcy

7041252: Use j.u.Objects.equals in security classes

Reviewed-by: weijun
上级 385f0890
...@@ -4193,15 +4193,11 @@ class Pair<A, B> { ...@@ -4193,15 +4193,11 @@ class Pair<A, B> {
return "Pair[" + fst + "," + snd + "]"; return "Pair[" + fst + "," + snd + "]";
} }
private static boolean equals(Object x, Object y) {
return (x == null && y == null) || (x != null && x.equals(y));
}
public boolean equals(Object other) { public boolean equals(Object other) {
return return
other instanceof Pair && other instanceof Pair &&
equals(fst, ((Pair)other).fst) && Objects.equals(fst, ((Pair)other).fst) &&
equals(snd, ((Pair)other).snd); Objects.equals(snd, ((Pair)other).snd);
} }
public int hashCode() { public int hashCode() {
......
/* /*
* Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -318,13 +318,6 @@ public class DistributionPoint { ...@@ -318,13 +318,6 @@ public class DistributionPoint {
out.write(DerValue.tag_Sequence, tagged); out.write(DerValue.tag_Sequence, tagged);
} }
/**
* Utility function for a.equals(b) where both a and b may be null.
*/
private static boolean equals(Object a, Object b) {
return (a == null) ? (b == null) : a.equals(b);
}
/** /**
* Compare an object to this DistributionPoint for equality. * Compare an object to this DistributionPoint for equality.
* *
...@@ -340,9 +333,9 @@ public class DistributionPoint { ...@@ -340,9 +333,9 @@ public class DistributionPoint {
} }
DistributionPoint other = (DistributionPoint)obj; DistributionPoint other = (DistributionPoint)obj;
boolean equal = equals(this.fullName, other.fullName) boolean equal = Objects.equals(this.fullName, other.fullName)
&& equals(this.relativeName, other.relativeName) && Objects.equals(this.relativeName, other.relativeName)
&& equals(this.crlIssuer, other.crlIssuer) && Objects.equals(this.crlIssuer, other.crlIssuer)
&& Arrays.equals(this.reasonFlags, other.reasonFlags); && Arrays.equals(this.reasonFlags, other.reasonFlags);
return equal; return equal;
} }
......
/* /*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -201,8 +201,8 @@ public class DistributionPointName { ...@@ -201,8 +201,8 @@ public class DistributionPointName {
} }
DistributionPointName other = (DistributionPointName)obj; DistributionPointName other = (DistributionPointName)obj;
return equals(this.fullName, other.fullName) && return Objects.equals(this.fullName, other.fullName) &&
equals(this.relativeName, other.relativeName); Objects.equals(this.relativeName, other.relativeName);
} }
/** /**
...@@ -239,11 +239,4 @@ public class DistributionPointName { ...@@ -239,11 +239,4 @@ public class DistributionPointName {
return sb.toString(); return sb.toString();
} }
/*
* Utility function for a.equals(b) where both a and b may be null.
*/
private static boolean equals(Object a, Object b) {
return (a == null) ? (b == null) : a.equals(b);
}
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册