hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1528737 - in /httpcomponents/httpcore/trunk/httpcore/src: main/java/org/apache/http/HttpHost.java test/java/org/apache/http/TestHttpHost.java
Date Thu, 03 Oct 2013 07:51:12 GMT
Author: olegk
Date: Thu Oct  3 07:51:12 2013
New Revision: 1528737

URL: http://svn.apache.org/r1528737
Log:
HTTPCORE-353: disallow empty hostname values for HttpHost

Modified:
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HttpHost.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/TestHttpHost.java

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HttpHost.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HttpHost.java?rev=1528737&r1=1528736&r2=1528737&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HttpHost.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HttpHost.java Thu
Oct  3 07:51:12 2013
@@ -78,7 +78,7 @@ public final class HttpHost implements C
      */
     public HttpHost(final String hostname, final int port, final String scheme) {
         super();
-        this.hostname   = Args.notNull(hostname, "Host name");
+        this.hostname   = Args.notBlank(hostname, "Host name");
         this.lcHostname = hostname.toLowerCase(Locale.ENGLISH);
         if (scheme != null) {
             this.schemeName = scheme.toLowerCase(Locale.ENGLISH);

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/TestHttpHost.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/TestHttpHost.java?rev=1528737&r1=1528736&r2=1528737&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/TestHttpHost.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/TestHttpHost.java
Thu Oct  3 07:51:12 2013
@@ -66,6 +66,11 @@ public class TestHttpHost {
         } catch (final IllegalArgumentException expected) {
         }
         try {
+            new HttpHost("   ", -1, null);
+            Assert.fail("IllegalArgumentException should have been thrown");
+        } catch (final IllegalArgumentException expected) {
+        }
+        try {
             new HttpHost((InetAddress) null, -1, null);
             Assert.fail("IllegalArgumentException should have been thrown");
         } catch (final IllegalArgumentException expected) {



Mime
View raw message