--- a/src/java.base/share/classes/sun/security/util/Cache.java Tue Oct 03 23:42:08 2017 -0700
+++ b/src/java.base/share/classes/sun/security/util/Cache.java Wed Oct 04 01:08:36 2017 -0700
@@ -164,7 +164,7 @@
public static class EqualByteArray {
private final byte[] b;
- private volatile int hash;
+ private int hash;
public EqualByteArray(byte[] b) {
this.b = b;
@@ -172,12 +172,8 @@
public int hashCode() {
int h = hash;
- if (h == 0) {
- h = b.length + 1;
- for (int i = 0; i < b.length; i++) {
- h += (b[i] & 0xff) * 37;
- }
- hash = h;
+ if (h == 0 && b.length > 0) {
+ hash = h = Arrays.hashCode(b);
}
return h;
}