hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1591221 - in /httpcomponents/httpclient/trunk/httpclient/src: main/java/org/apache/http/client/utils/URIUtils.java test/java/org/apache/http/client/utils/TestURIUtils.java
Date Wed, 30 Apr 2014 09:32:52 GMT
Author: olegk
Date: Wed Apr 30 09:32:52 2014
New Revision: 1591221

URL: http://svn.apache.org/r1591221
Log:
HTTPCLIENT-1498: empty host in redirect location causes NPE

Modified:
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/utils/TestURIUtils.java

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java?rev=1591221&r1=1591220&r2=1591221&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java
Wed Apr 30 09:32:52 2014
@@ -366,7 +366,7 @@ public class URIUtils {
                 }
             }
             final String scheme = uri.getScheme();
-            if (host != null) {
+            if (!TextUtils.isBlank(host)) {
                 target = new HttpHost(host, port, scheme);
             }
         }

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/utils/TestURIUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/utils/TestURIUtils.java?rev=1591221&r1=1591220&r2=1591221&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/utils/TestURIUtils.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/utils/TestURIUtils.java
Wed Apr 30 09:32:52 2014
@@ -229,6 +229,8 @@ public class TestURIUtils {
                 URIUtils.extractHost(new URI("http://localhost:8080;sessionid=stuff/abcd")));
         Assert.assertEquals(new HttpHost("localhost",-1),
                 URIUtils.extractHost(new URI("http://localhost:;sessionid=stuff/abcd")));
+        Assert.assertEquals(null,
+                URIUtils.extractHost(new URI("http://:80/robots.txt")));
     }
 
     @Test



Mime
View raw message