--- old/src/java.base/share/classes/sun/security/ssl/SessionId.java 2017-11-22 10:20:33.180131472 +0100 +++ new/src/java.base/share/classes/sun/security/ssl/SessionId.java 2017-11-22 10:20:32.954135385 +0100 @@ -27,6 +27,7 @@ package sun.security.ssl; import java.security.SecureRandom; +import java.util.Arrays; import javax.net.ssl.SSLProtocolException; /** @@ -91,30 +92,15 @@ @Override public int hashCode () { - int retval = 0; - - for (int i = 0; i < sessionId.length; i++) - retval += sessionId [i]; - return retval; + return Arrays.hashCode(sessionId); } /** Returns true if the parameter is the same session ID */ @Override public boolean equals (Object obj) { - if (!(obj instanceof SessionId)) - return false; - - SessionId s = (SessionId) obj; - byte[] b = s.getId (); - - if (b.length != sessionId.length) - return false; - for (int i = 0; i < sessionId.length; i++) { - if (b [i] != sessionId [i]) - return false; - } - return true; + return obj instanceof SessionId && + Arrays.equals(sessionId, ((SessionId)obj).sessionId); } /**