diff -r 49b7de969579 -r e71aa0962e70 jdk/src/share/classes/sun/security/ssl/SSLSessionImpl.java --- a/jdk/src/share/classes/sun/security/ssl/SSLSessionImpl.java Sat Nov 24 03:34:27 2012 -0800 +++ b/jdk/src/share/classes/sun/security/ssl/SSLSessionImpl.java Sat Nov 24 04:09:19 2012 -0800 @@ -26,12 +26,10 @@ package sun.security.ssl; -import java.io.*; import java.net.*; import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -45,20 +43,14 @@ import javax.crypto.SecretKey; -import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSessionContext; import javax.net.ssl.SSLSessionBindingListener; import javax.net.ssl.SSLSessionBindingEvent; import javax.net.ssl.SSLPeerUnverifiedException; -import javax.net.ssl.SSLSession; import javax.net.ssl.SSLPermission; -import javax.net.ssl.SSLException; import javax.net.ssl.ExtendedSSLSession; import javax.net.ssl.SNIServerName; -import javax.security.auth.x500.X500Principal; - -import static sun.security.ssl.CipherSuite.*; import static sun.security.ssl.CipherSuite.KeyExchange.*; /** @@ -250,6 +242,7 @@ !invalidated && isLocalAuthenticationValid(); } + @Override public synchronized boolean isValid() { return isRejoinable(); } @@ -277,6 +270,7 @@ * Returns the ID for this session. The ID is fixed for the * duration of the session; neither it, nor its value, changes. */ + @Override public byte[] getId() { return sessionId.getId(); } @@ -286,6 +280,7 @@ * are currently valid in this process. For client sessions, * this returns null. */ + @Override public SSLSessionContext getSessionContext() { /* * An interim security policy until we can do something @@ -332,6 +327,7 @@ /** * Returns the name of the cipher suite in use on this session */ + @Override public String getCipherSuite() { return getSuite().name; } @@ -343,6 +339,7 @@ /** * Returns the standard name of the protocol in use on this session */ + @Override public String getProtocol() { return getProtocolVersion().name; } @@ -357,6 +354,7 @@ /** * Returns the hashcode for this session */ + @Override public int hashCode() { return sessionId.hashCode(); } @@ -365,6 +363,7 @@ /** * Returns true if sessions have same ids, false otherwise. */ + @Override public boolean equals(Object obj) { if (obj == this) { @@ -391,6 +390,7 @@ * @return array of peer X.509 certs, with the peer's own cert * first in the chain, and with the "root" CA last. */ + @Override public java.security.cert.Certificate[] getPeerCertificates() throws SSLPeerUnverifiedException { // @@ -421,6 +421,7 @@ * @return array of peer X.509 certs, with the peer's own cert * first in the chain, and with the "root" CA last. */ + @Override public java.security.cert.Certificate[] getLocalCertificates() { // // clone to preserve integrity of session ... caller can't @@ -440,6 +441,7 @@ * @return array of peer X.509 certs, with the peer's own cert * first in the chain, and with the "root" CA last. */ + @Override public javax.security.cert.X509Certificate[] getPeerCertificateChain() throws SSLPeerUnverifiedException { // @@ -511,6 +513,7 @@ * @throws SSLPeerUnverifiedException if the peer's identity has not * been verified */ + @Override public Principal getPeerPrincipal() throws SSLPeerUnverifiedException { @@ -537,6 +540,7 @@ * Principal for Kerberos cipher suites. If no principal was * sent, then null is returned. */ + @Override public Principal getLocalPrincipal() { if ((cipherSuite.keyExchange == K_KRB5) || @@ -551,6 +555,7 @@ /** * Returns the time this session was created. */ + @Override public long getCreationTime() { return creationTime; } @@ -559,6 +564,7 @@ * Returns the last time this session was used to initialize * a connection. */ + @Override public long getLastAccessedTime() { return (lastUsedTime != 0) ? lastUsedTime : creationTime; } @@ -582,6 +588,7 @@ } } + @Override public String getPeerHost() { return host; } @@ -590,6 +597,7 @@ * Need to provide the port info for caching sessions based on * host and port. Accessed by SSLSessionContextImpl */ + @Override public int getPeerPort() { return port; } @@ -604,6 +612,7 @@ * Invalidate a session. Active connections may still exist, but * no connections will be able to rejoin this session. */ + @Override synchronized public void invalidate() { // // Can't invalidate the NULL session -- this would be @@ -634,6 +643,7 @@ * Assigns a session value. Session change events are given if * appropriate, to any original value as well as the new value. */ + @Override public void putValue(String key, Object value) { if ((key == null) || (value == null)) { throw new IllegalArgumentException("arguments can not be null"); @@ -660,6 +670,7 @@ /** * Returns the specified session value. */ + @Override public Object getValue(String key) { if (key == null) { throw new IllegalArgumentException("argument can not be null"); @@ -674,6 +685,7 @@ * Removes the specified session value, delivering a session changed * event as appropriate. */ + @Override public void removeValue(String key) { if (key == null) { throw new IllegalArgumentException("argument can not be null"); @@ -694,6 +706,7 @@ /** * Lists the names of the session values. */ + @Override public String[] getValueNames() { Enumeration e; Vector v = new Vector<>(); @@ -741,6 +754,7 @@ * Gets the current size of the largest SSL/TLS packet that is expected * when using this session. */ + @Override public synchronized int getPacketBufferSize() { return acceptLargeFragments ? Record.maxLargeRecordSize : Record.maxRecordSize; @@ -750,6 +764,7 @@ * Gets the current size of the largest application data that is * expected when using this session. */ + @Override public synchronized int getApplicationBufferSize() { return getPacketBufferSize() - Record.headerSize; } @@ -795,6 +810,7 @@ } /** Returns a string representation of this SSL session */ + @Override public String toString() { return "[Session-" + sessionCount + ", " + getCipherSuite() @@ -805,6 +821,7 @@ * When SSL sessions are finalized, all values bound to * them are removed. */ + @Override public void finalize() { String[] names = getValueNames(); for (int i = 0; i < names.length; i++) { @@ -847,10 +864,12 @@ return securityCtx; } + @Override public int hashCode() { return appKey.hashCode() ^ securityCtx.hashCode(); } + @Override public boolean equals(Object o) { return o instanceof SecureKey && ((SecureKey)o).appKey.equals(appKey) && ((SecureKey)o).securityCtx.equals(securityCtx);