From f533b173d885ec656d9a8f620a793b637293a46e Mon Sep 17 00:00:00 2001 From: xuelei Date: Sun, 18 Nov 2012 01:31:44 -0800 Subject: [PATCH] 8003587: Warning cleanup in package javax.net.ssl Summary: Removes unnecessary imports and adds missing Override annotations Reviewed-by: xuelei Contributed-by: Florian Weimer --- .../classes/javax/net/ssl/HandshakeCompletedEvent.java | 1 - src/share/classes/javax/net/ssl/HostnameVerifier.java | 1 + src/share/classes/javax/net/ssl/HttpsURLConnection.java | 2 +- src/share/classes/javax/net/ssl/KeyManagerFactory.java | 1 + src/share/classes/javax/net/ssl/SSLContext.java | 1 - src/share/classes/javax/net/ssl/SSLContextSpi.java | 1 - src/share/classes/javax/net/ssl/SSLEngineResult.java | 1 + src/share/classes/javax/net/ssl/SSLParameters.java | 2 -- src/share/classes/javax/net/ssl/SSLPermission.java | 5 ----- .../classes/javax/net/ssl/SSLServerSocketFactory.java | 6 ++++++ src/share/classes/javax/net/ssl/SSLSession.java | 1 - src/share/classes/javax/net/ssl/SSLSocket.java | 3 --- src/share/classes/javax/net/ssl/SSLSocketFactory.java | 9 +++++++++ src/share/classes/javax/net/ssl/TrustManagerFactory.java | 1 + src/share/classes/javax/net/ssl/X509KeyManager.java | 1 - 15 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/share/classes/javax/net/ssl/HandshakeCompletedEvent.java b/src/share/classes/javax/net/ssl/HandshakeCompletedEvent.java index 39e802c4d..f6abafaea 100644 --- a/src/share/classes/javax/net/ssl/HandshakeCompletedEvent.java +++ b/src/share/classes/javax/net/ssl/HandshakeCompletedEvent.java @@ -29,7 +29,6 @@ import java.util.EventObject; import java.security.cert.Certificate; import java.security.Principal; import java.security.cert.X509Certificate; -import javax.security.auth.x500.X500Principal; /** * This event indicates that an SSL handshake completed on a given diff --git a/src/share/classes/javax/net/ssl/HostnameVerifier.java b/src/share/classes/javax/net/ssl/HostnameVerifier.java index d2f504f05..402a8cd66 100644 --- a/src/share/classes/javax/net/ssl/HostnameVerifier.java +++ b/src/share/classes/javax/net/ssl/HostnameVerifier.java @@ -40,6 +40,7 @@ package javax.net.ssl; * verification fail. * * @author Brad R. Wetmore + * @see HostnameVerifierFactory * @since 1.4 */ diff --git a/src/share/classes/javax/net/ssl/HttpsURLConnection.java b/src/share/classes/javax/net/ssl/HttpsURLConnection.java index 5027b9a57..b4c9ffe11 100644 --- a/src/share/classes/javax/net/ssl/HttpsURLConnection.java +++ b/src/share/classes/javax/net/ssl/HttpsURLConnection.java @@ -29,7 +29,6 @@ import java.net.URL; import java.net.HttpURLConnection; import java.security.Principal; import java.security.cert.X509Certificate; -import javax.security.auth.x500.X500Principal; /** * HttpsURLConnection extends HttpURLConnection @@ -196,6 +195,7 @@ class HttpsURLConnection extends HttpURLConnection */ private static class DefaultHostnameVerifier implements HostnameVerifier { + @Override public boolean verify(String hostname, SSLSession session) { return false; } diff --git a/src/share/classes/javax/net/ssl/KeyManagerFactory.java b/src/share/classes/javax/net/ssl/KeyManagerFactory.java index e7fe89f65..f9611c0f1 100644 --- a/src/share/classes/javax/net/ssl/KeyManagerFactory.java +++ b/src/share/classes/javax/net/ssl/KeyManagerFactory.java @@ -68,6 +68,7 @@ public class KeyManagerFactory { public final static String getDefaultAlgorithm() { String type; type = AccessController.doPrivileged(new PrivilegedAction() { + @Override public String run() { return Security.getProperty( "ssl.KeyManagerFactory.algorithm"); diff --git a/src/share/classes/javax/net/ssl/SSLContext.java b/src/share/classes/javax/net/ssl/SSLContext.java index d3cb9700b..c40d7060c 100644 --- a/src/share/classes/javax/net/ssl/SSLContext.java +++ b/src/share/classes/javax/net/ssl/SSLContext.java @@ -26,7 +26,6 @@ package javax.net.ssl; import java.security.*; -import java.util.*; import sun.security.jca.GetInstance; diff --git a/src/share/classes/javax/net/ssl/SSLContextSpi.java b/src/share/classes/javax/net/ssl/SSLContextSpi.java index e4def55a0..0b06191cc 100644 --- a/src/share/classes/javax/net/ssl/SSLContextSpi.java +++ b/src/share/classes/javax/net/ssl/SSLContextSpi.java @@ -25,7 +25,6 @@ package javax.net.ssl; -import java.util.*; import java.security.*; /** diff --git a/src/share/classes/javax/net/ssl/SSLEngineResult.java b/src/share/classes/javax/net/ssl/SSLEngineResult.java index dd63ea480..45dcddbde 100644 --- a/src/share/classes/javax/net/ssl/SSLEngineResult.java +++ b/src/share/classes/javax/net/ssl/SSLEngineResult.java @@ -230,6 +230,7 @@ public class SSLEngineResult { /** * Returns a String representation of this object. */ + @Override public String toString() { return ("Status = " + status + " HandshakeStatus = " + handshakeStatus + diff --git a/src/share/classes/javax/net/ssl/SSLParameters.java b/src/share/classes/javax/net/ssl/SSLParameters.java index d207f6f9e..c499b6660 100644 --- a/src/share/classes/javax/net/ssl/SSLParameters.java +++ b/src/share/classes/javax/net/ssl/SSLParameters.java @@ -28,13 +28,11 @@ package javax.net.ssl; import java.security.AlgorithmConstraints; import java.util.Map; import java.util.List; -import java.util.HashSet; import java.util.HashMap; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.LinkedHashMap; -import java.util.regex.Pattern; /** * Encapsulates parameters for an SSL/TLS connection. The parameters diff --git a/src/share/classes/javax/net/ssl/SSLPermission.java b/src/share/classes/javax/net/ssl/SSLPermission.java index f596925e0..04ebfe154 100644 --- a/src/share/classes/javax/net/ssl/SSLPermission.java +++ b/src/share/classes/javax/net/ssl/SSLPermission.java @@ -26,11 +26,6 @@ package javax.net.ssl; import java.security.*; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.StringTokenizer; -import java.security.Permissions; -import java.lang.SecurityManager; /** * This class is for various network permissions. diff --git a/src/share/classes/javax/net/ssl/SSLServerSocketFactory.java b/src/share/classes/javax/net/ssl/SSLServerSocketFactory.java index 24911295a..8efbd4166 100644 --- a/src/share/classes/javax/net/ssl/SSLServerSocketFactory.java +++ b/src/share/classes/javax/net/ssl/SSLServerSocketFactory.java @@ -160,23 +160,27 @@ class DefaultSSLServerSocketFactory extends SSLServerSocketFactory { new SocketException(reason.toString()).initCause(reason); } + @Override public ServerSocket createServerSocket() throws IOException { return throwException(); } + @Override public ServerSocket createServerSocket(int port) throws IOException { return throwException(); } + @Override public ServerSocket createServerSocket(int port, int backlog) throws IOException { return throwException(); } + @Override public ServerSocket createServerSocket(int port, int backlog, InetAddress ifAddress) throws IOException @@ -184,10 +188,12 @@ class DefaultSSLServerSocketFactory extends SSLServerSocketFactory { return throwException(); } + @Override public String [] getDefaultCipherSuites() { return new String[0]; } + @Override public String [] getSupportedCipherSuites() { return new String[0]; } diff --git a/src/share/classes/javax/net/ssl/SSLSession.java b/src/share/classes/javax/net/ssl/SSLSession.java index 93f066744..7cbcf2836 100644 --- a/src/share/classes/javax/net/ssl/SSLSession.java +++ b/src/share/classes/javax/net/ssl/SSLSession.java @@ -25,7 +25,6 @@ package javax.net.ssl; -import java.net.InetAddress; import java.security.Principal; /** diff --git a/src/share/classes/javax/net/ssl/SSLSocket.java b/src/share/classes/javax/net/ssl/SSLSocket.java index ab090130f..58f943ace 100644 --- a/src/share/classes/javax/net/ssl/SSLSocket.java +++ b/src/share/classes/javax/net/ssl/SSLSocket.java @@ -28,9 +28,6 @@ package javax.net.ssl; import java.io.IOException; import java.net.*; -import java.util.Enumeration; -import java.util.Vector; - /** * This class extends Sockets and provides secure diff --git a/src/share/classes/javax/net/ssl/SSLSocketFactory.java b/src/share/classes/javax/net/ssl/SSLSocketFactory.java index 73f48d197..151880d02 100644 --- a/src/share/classes/javax/net/ssl/SSLSocketFactory.java +++ b/src/share/classes/javax/net/ssl/SSLSocketFactory.java @@ -127,6 +127,7 @@ public abstract class SSLSocketFactory extends SocketFactory static String getSecurityProperty(final String name) { return AccessController.doPrivileged(new PrivilegedAction() { + @Override public String run() { String s = java.security.Security.getProperty(name); if (s != null) { @@ -247,18 +248,21 @@ class DefaultSSLSocketFactory extends SSLSocketFactory new SocketException(reason.toString()).initCause(reason); } + @Override public Socket createSocket() throws IOException { return throwException(); } + @Override public Socket createSocket(String host, int port) throws IOException { return throwException(); } + @Override public Socket createSocket(Socket s, String host, int port, boolean autoClose) throws IOException @@ -266,12 +270,14 @@ class DefaultSSLSocketFactory extends SSLSocketFactory return throwException(); } + @Override public Socket createSocket(InetAddress address, int port) throws IOException { return throwException(); } + @Override public Socket createSocket(String host, int port, InetAddress clientAddress, int clientPort) throws IOException @@ -279,6 +285,7 @@ class DefaultSSLSocketFactory extends SSLSocketFactory return throwException(); } + @Override public Socket createSocket(InetAddress address, int port, InetAddress clientAddress, int clientPort) throws IOException @@ -286,10 +293,12 @@ class DefaultSSLSocketFactory extends SSLSocketFactory return throwException(); } + @Override public String [] getDefaultCipherSuites() { return new String[0]; } + @Override public String [] getSupportedCipherSuites() { return new String[0]; } diff --git a/src/share/classes/javax/net/ssl/TrustManagerFactory.java b/src/share/classes/javax/net/ssl/TrustManagerFactory.java index b1762fc64..91b6a0e46 100644 --- a/src/share/classes/javax/net/ssl/TrustManagerFactory.java +++ b/src/share/classes/javax/net/ssl/TrustManagerFactory.java @@ -65,6 +65,7 @@ public class TrustManagerFactory { public final static String getDefaultAlgorithm() { String type; type = AccessController.doPrivileged(new PrivilegedAction() { + @Override public String run() { return Security.getProperty( "ssl.TrustManagerFactory.algorithm"); diff --git a/src/share/classes/javax/net/ssl/X509KeyManager.java b/src/share/classes/javax/net/ssl/X509KeyManager.java index 3fcf2225b..5174adfe4 100644 --- a/src/share/classes/javax/net/ssl/X509KeyManager.java +++ b/src/share/classes/javax/net/ssl/X509KeyManager.java @@ -25,7 +25,6 @@ package javax.net.ssl; -import java.security.KeyManagementException; import java.security.PrivateKey; import java.security.Principal; import java.security.cert.X509Certificate; -- GitLab