hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject [21/50] httpcomponents-core git commit: HTTPCORE-447: HttpHost#create does not throw IllegalArgumentException for empty string
Date Tue, 09 May 2017 20:01:47 GMT
HTTPCORE-447: HttpHost#create does not throw IllegalArgumentException for empty string

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1784126
13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/2e2d511b
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/2e2d511b
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/2e2d511b

Branch: refs/heads/4.4.x
Commit: 2e2d511b869b01479fc26a21f8a97aab4f828e11
Parents: f7b81af
Author: Oleg Kalnichevski <olegk@apache.org>
Authored: Thu Feb 23 13:22:39 2017 +0000
Committer: Oleg Kalnichevski <olegk@apache.org>
Committed: Thu Feb 23 13:22:39 2017 +0000

----------------------------------------------------------------------
 httpcore/src/main/java/org/apache/http/util/Args.java    | 3 +++
 httpcore/src/test/java/org/apache/http/TestHttpHost.java | 5 +++++
 2 files changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/2e2d511b/httpcore/src/main/java/org/apache/http/util/Args.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/util/Args.java b/httpcore/src/main/java/org/apache/http/util/Args.java
index 9eb8a25..6f08674 100644
--- a/httpcore/src/main/java/org/apache/http/util/Args.java
+++ b/httpcore/src/main/java/org/apache/http/util/Args.java
@@ -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");
         }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/2e2d511b/httpcore/src/test/java/org/apache/http/TestHttpHost.java
----------------------------------------------------------------------
diff --git a/httpcore/src/test/java/org/apache/http/TestHttpHost.java b/httpcore/src/test/java/org/apache/http/TestHttpHost.java
index 71f161b..674d9e3 100644
--- a/httpcore/src/test/java/org/apache/http/TestHttpHost.java
+++ b/httpcore/src/test/java/org/apache/http/TestHttpHost.java
@@ -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