hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1053589 - in /httpcomponents/httpclient/trunk/httpclient/src: main/java/org/apache/http/conn/scheme/ main/java/org/apache/http/conn/ssl/ test/java/org/apache/http/conn/
Date Wed, 29 Dec 2010 09:54:02 GMT
Author: olegk
Date: Wed Dec 29 09:54:02 2010
New Revision: 1053589

URL: http://svn.apache.org/viewvc?rev=1053589&view=rev
Log:
Removed static socket factories; adjusted Scheme#hashCode and Scheme#equals

Modified:
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/scheme/PlainSocketFactory.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/scheme/Scheme.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl/SSLSocketFactory.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/TestScheme.java

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/scheme/PlainSocketFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/scheme/PlainSocketFactory.java?rev=1053589&r1=1053588&r2=1053589&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/scheme/PlainSocketFactory.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/scheme/PlainSocketFactory.java
Wed Dec 29 09:54:02 2010
@@ -56,21 +56,15 @@ import org.apache.http.params.HttpParams
 @Immutable
 public class PlainSocketFactory implements SocketFactory, SchemeSocketFactory {
 
-    /**
-     * The default factory.
-     */
-    private static final PlainSocketFactory DEFAULT_FACTORY = new PlainSocketFactory();
-
     private final HostNameResolver nameResolver;
 
     /**
-     * Gets the default factory. Usually there should be no reason for creating
-     * multiple instances of this class.
+     * Gets the default factory.
      *
      * @return the default factory
      */
     public static PlainSocketFactory getSocketFactory() {
-        return DEFAULT_FACTORY;
+        return new PlainSocketFactory();
     }
 
     @Deprecated

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/scheme/Scheme.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/scheme/Scheme.java?rev=1053589&r1=1053588&r2=1053589&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/scheme/Scheme.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/scheme/Scheme.java
Wed Dec 29 09:54:02 2010
@@ -242,8 +242,7 @@ public final class Scheme {
             Scheme that = (Scheme) obj;
             return this.name.equals(that.name)
                 && this.defaultPort == that.defaultPort
-                && this.layered == that.layered
-                && this.socketFactory.equals(that.socketFactory);
+                && this.layered == that.layered;
         } else {
             return false;
         }
@@ -255,7 +254,6 @@ public final class Scheme {
         hash = LangUtils.hashCode(hash, this.defaultPort);
         hash = LangUtils.hashCode(hash, this.name);
         hash = LangUtils.hashCode(hash, this.layered);
-        hash = LangUtils.hashCode(hash, this.socketFactory);
         return hash;
     }
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl/SSLSocketFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl/SSLSocketFactory.java?rev=1053589&r1=1053588&r2=1053589&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl/SSLSocketFactory.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl/SSLSocketFactory.java
Wed Dec 29 09:54:02 2010
@@ -156,18 +156,13 @@ public class SSLSocketFactory implements
         = new StrictHostnameVerifier();
 
     /**
-     * The default factory using the default JVM settings for secure connections.
-     */
-    private static final SSLSocketFactory DEFAULT_FACTORY = new SSLSocketFactory();
-
-    /**
      * Gets the default factory, which uses the default JVM settings for secure
      * connections.
      *
      * @return the default factory
      */
     public static SSLSocketFactory getSocketFactory() {
-        return DEFAULT_FACTORY;
+        return new SSLSocketFactory();
     }
 
     private final javax.net.ssl.SSLSocketFactory socketfactory;

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/TestScheme.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/TestScheme.java?rev=1053589&r1=1053588&r2=1053589&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/TestScheme.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/TestScheme.java
Wed Dec 29 09:54:02 2010
@@ -47,12 +47,10 @@ public class TestScheme {
         Scheme http = new Scheme("http", 80, PlainSocketFactory.getSocketFactory());
         Assert.assertEquals("http", http.getName());
         Assert.assertEquals(80, http.getDefaultPort());
-        Assert.assertSame(PlainSocketFactory.getSocketFactory(), http.getSchemeSocketFactory());
         Assert.assertFalse(http.isLayered());
         Scheme https = new Scheme("https", 443, SecureSocketFactoryMockup.INSTANCE);
         Assert.assertEquals("https", https.getName());
         Assert.assertEquals(443, https.getDefaultPort());
-        Assert.assertSame(SecureSocketFactoryMockup.INSTANCE, https.getSchemeSocketFactory());
         Assert.assertTrue(https.isLayered());
 
         Scheme hTtP = new Scheme("hTtP", 80, PlainSocketFactory.getSocketFactory());



Mime
View raw message