< prev index next >
src/java.base/share/classes/sun/security/ssl/SessionId.java
Print this page
*** 25,34 ****
--- 25,35 ----
package sun.security.ssl;
import java.security.SecureRandom;
+ import java.util.Arrays;
import javax.net.ssl.SSLProtocolException;
/**
* Encapsulates an SSL session ID. SSL Session IDs are not reused by
* servers during the lifetime of any sessions it created. Sessions may
*** 89,122 ****
/** Returns a value which is the same for session IDs which are equal */
@Override
public int hashCode ()
{
! int retval = 0;
!
! for (int i = 0; i < sessionId.length; i++)
! retval += sessionId [i];
! return retval;
}
/** 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;
}
/**
* Checks the length of the session ID to make sure it sits within
* the range called out in the specification
--- 90,108 ----
/** Returns a value which is the same for session IDs which are equal */
@Override
public int hashCode ()
{
! return Arrays.hashCode(sessionId);
}
/** Returns true if the parameter is the same session ID */
@Override
public boolean equals (Object obj)
{
! return obj instanceof SessionId &&
! Arrays.equals(sessionId, ((SessionId)obj).sessionId);
}
/**
* Checks the length of the session ID to make sure it sits within
* the range called out in the specification
< prev index next >