hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject [35/50] [abbrv] httpcomponents-core git commit: HTTPCORE-458: Validate port values. Add checks and Javadoc.
Date Tue, 09 May 2017 19:58:27 GMT
HTTPCORE-458: Validate port values. Add checks and Javadoc.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk@1792684 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/f89ce937
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/f89ce937
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/f89ce937

Branch: refs/heads/trunk
Commit: f89ce937c8aff5fe0423e2239e6d1afde877e66a
Parents: 8faaa62
Author: Gary D. Gregory <ggregory@apache.org>
Authored: Tue Apr 25 23:26:07 2017 +0000
Committer: Gary D. Gregory <ggregory@apache.org>
Committed: Tue Apr 25 23:26:07 2017 +0000

----------------------------------------------------------------------
 .../java/org/apache/hc/core5/net/URIAuthority.java    | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/f89ce937/httpcore5/src/main/java/org/apache/hc/core5/net/URIAuthority.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/net/URIAuthority.java b/httpcore5/src/main/java/org/apache/hc/core5/net/URIAuthority.java
index 2dbba21..74d7ab6 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/net/URIAuthority.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/net/URIAuthority.java
@@ -49,13 +49,23 @@ public final class URIAuthority implements NamedEndpoint, Serializable
{
     private final String hostname;
     private final int port;
 
+    /**
+     * @throws IllegalArgumentException
+     *             If the port parameter is outside the specified range of valid port values,
which is between 0 and
+     *             65535, inclusive. {@code -1} indicates the scheme default port.
+     */
     private URIAuthority(final String userInfo, final String hostname, final int port, final
boolean internal) {
         super();
         this.userInfo = userInfo;
         this.hostname = hostname;
-        this.port = port;
+        this.port = Ports.check(port);
     }
 
+    /**
+     * @throws IllegalArgumentException
+     *             If the port parameter is outside the specified range of valid port values,
which is between 0 and
+     *             65535, inclusive. {@code -1} indicates the scheme default port.
+     */
     public URIAuthority(final String userInfo, final String hostname, final int port) {
         super();
         Args.containsNoBlanks(hostname, "Host name");
@@ -64,7 +74,7 @@ public final class URIAuthority implements NamedEndpoint, Serializable {
         }
         this.userInfo = userInfo;
         this.hostname = hostname.toLowerCase(Locale.ROOT);
-        this.port = port;
+        this.port = Ports.check(port);
     }
 
     public URIAuthority(final String hostname, final int port) {


Mime
View raw message