hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1784126 - in /httpcomponents/httpcore/branches/4.4.x/httpcore/src: main/java/org/apache/http/util/Args.java test/java/org/apache/http/TestHttpHost.java
Date Thu, 23 Feb 2017 13:22:39 GMT
Author: olegk
Date: Thu Feb 23 13:22:39 2017
New Revision: 1784126

URL: http://svn.apache.org/viewvc?rev=1784126&view=rev
Log:
HTTPCORE-447: HttpHost#create does not throw IllegalArgumentException for empty string

Modified:
    httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/util/Args.java
    httpcomponents/httpcore/branches/4.4.x/httpcore/src/test/java/org/apache/http/TestHttpHost.java

Modified: httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/util/Args.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/util/Args.java?rev=1784126&r1=1784125&r2=1784126&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/util/Args.java
(original)
+++ httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/util/Args.java
Thu Feb 23 13:22:39 2017
@@ -80,6 +80,9 @@ public class Args {
         if (argument == null) {
             throw new IllegalArgumentException(name + " may not be null");
         }
+        if (argument.length() == 0) {
+            throw new IllegalArgumentException(name + " may not be empty");
+        }
         if (TextUtils.containsBlanks(argument)) {
             throw new IllegalArgumentException(name + " may not contain blanks");
         }

Modified: httpcomponents/httpcore/branches/4.4.x/httpcore/src/test/java/org/apache/http/TestHttpHost.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.4.x/httpcore/src/test/java/org/apache/http/TestHttpHost.java?rev=1784126&r1=1784125&r2=1784126&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.4.x/httpcore/src/test/java/org/apache/http/TestHttpHost.java
(original)
+++ httpcomponents/httpcore/branches/4.4.x/httpcore/src/test/java/org/apache/http/TestHttpHost.java
Thu Feb 23 13:22:39 2017
@@ -222,6 +222,11 @@ public class TestHttpHost {
             Assert.fail("IllegalArgumentException expected");
         } catch (final IllegalArgumentException expected) {
         }
+        try {
+            HttpHost.create("");
+            Assert.fail("IllegalArgumentException expected");
+        } catch (final IllegalArgumentException expected) {
+        }
     }
 
 }



Mime
View raw message