harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r726378 - /harmony/enhanced/classlib/trunk/modules/x-net/src/main/java/javax/net/ssl/HttpsURLConnection.java
Date Sun, 14 Dec 2008 05:57:30 GMT
Author: ndbeyer
Date: Sat Dec 13 21:57:29 2008
New Revision: 726378

URL: http://svn.apache.org/viewvc?rev=726378&view=rev
Log:
Make sslSocketFactory an instance field, per spec, rearrange static methods to top of class.

Modified:
    harmony/enhanced/classlib/trunk/modules/x-net/src/main/java/javax/net/ssl/HttpsURLConnection.java

Modified: harmony/enhanced/classlib/trunk/modules/x-net/src/main/java/javax/net/ssl/HttpsURLConnection.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/x-net/src/main/java/javax/net/ssl/HttpsURLConnection.java?rev=726378&r1=726377&r2=726378&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/x-net/src/main/java/javax/net/ssl/HttpsURLConnection.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/x-net/src/main/java/javax/net/ssl/HttpsURLConnection.java
Sat Dec 13 21:57:29 2008
@@ -28,10 +28,6 @@
 import java.security.cert.Certificate;
 import java.security.cert.X509Certificate;
 
-/**
- * @com.intel.drl.spec_ref
- * 
- */
 public abstract class HttpsURLConnection extends HttpURLConnection {
 
     private static HostnameVerifier defaultHostnameVerifier = new DefaultHostnameVerifier();
@@ -39,53 +35,60 @@
     private static SSLSocketFactory defaultSSLSocketFactory = (SSLSocketFactory) SSLSocketFactory
             .getDefault();
 
+    public static void setDefaultHostnameVerifier(HostnameVerifier v) {
+        if (v == null) {
+            throw new IllegalArgumentException("HostnameVerifier is null");
+        }
+        defaultHostnameVerifier = v;
+    }
+
+    public static HostnameVerifier getDefaultHostnameVerifier() {
+        return defaultHostnameVerifier;
+    }
+
+    public static void setDefaultSSLSocketFactory(SSLSocketFactory sf) {
+        if (sf == null) {
+            throw new IllegalArgumentException("SSLSocketFactory is null");
+        }
+        defaultSSLSocketFactory = sf;
+    }
+
+    public static SSLSocketFactory getDefaultSSLSocketFactory() {
+        return defaultSSLSocketFactory;
+    }
+
     protected HostnameVerifier hostnameVerifier;
 
-    private static SSLSocketFactory socketFactory;
+    private SSLSocketFactory sslSocketFactory;
 
     protected HttpsURLConnection(URL url) {
         super(url);
         hostnameVerifier = defaultHostnameVerifier;
-        socketFactory = defaultSSLSocketFactory;
+        sslSocketFactory = defaultSSLSocketFactory;
     }
 
     public abstract String getCipherSuite();
 
     public abstract Certificate[] getLocalCertificates();
 
-    public abstract Certificate[] getServerCertificates()
-            throws SSLPeerUnverifiedException;
+    public abstract Certificate[] getServerCertificates() throws SSLPeerUnverifiedException;
 
     public Principal getPeerPrincipal() throws SSLPeerUnverifiedException {
         Certificate[] certs = getServerCertificates();
-        if (certs == null || certs.length == 0 || 
-        		(!(certs[0] instanceof X509Certificate))) {
-            throw new SSLPeerUnverifiedException(
-                    "No server's end-entity certificate");
+        if (certs == null || certs.length == 0 || (!(certs[0] instanceof X509Certificate)))
{
+            throw new SSLPeerUnverifiedException("No server's end-entity certificate");
         }
         return ((X509Certificate) certs[0]).getSubjectX500Principal();
     }
 
     public Principal getLocalPrincipal() {
         Certificate[] certs = getLocalCertificates();
-        if (certs == null || certs.length == 0
-                || (!(certs[0] instanceof X509Certificate))) {
+        if (certs == null || certs.length == 0 || (!(certs[0] instanceof X509Certificate)))
{
             return null;
         }
         return ((X509Certificate) certs[0]).getSubjectX500Principal();
     }
 
-    public static void setDefaultHostnameVerifier(HostnameVerifier v) {
-        if (v == null) {
-            throw new IllegalArgumentException("HostnameVerifier is null");
-        }
-        defaultHostnameVerifier = v;
-    }
-
-    public static HostnameVerifier getDefaultHostnameVerifier() {
-        return defaultHostnameVerifier;
-    }
-
     public void setHostnameVerifier(HostnameVerifier v) {
         if (v == null) {
             throw new IllegalArgumentException("HostnameVerifier is null");
@@ -97,26 +100,15 @@
         return hostnameVerifier;
     }
 
-    public static void setDefaultSSLSocketFactory(SSLSocketFactory sf) {
-        if (sf == null) {
-            throw new IllegalArgumentException("SSLSocketFactory is null");
-        }
-        defaultSSLSocketFactory = sf;
-    }
-
-    public static SSLSocketFactory getDefaultSSLSocketFactory() {
-        return defaultSSLSocketFactory;
-    }
-
     public void setSSLSocketFactory(SSLSocketFactory sf) {
         if (sf == null) {
             throw new IllegalArgumentException("SSLSocketFactory is null");
         }
-        socketFactory = sf;
+        sslSocketFactory = sf;
     }
 
     public SSLSocketFactory getSSLSocketFactory() {
-        return socketFactory;
+        return sslSocketFactory;
     }
 
-}
\ No newline at end of file
+}



Mime
View raw message