hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1789821 - in /httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5: http/config/SocketConfig.java reactor/IOReactorConfig.java
Date Sat, 01 Apr 2017 17:10:42 GMT
Author: olegk
Date: Sat Apr  1 17:10:42 2017
New Revision: 1789821

URL: http://svn.apache.org/viewvc?rev=1789821&view=rev
Log:
HTTPCORE-451: ensure TimeValue parameters in SocketConfig and IOReactorConfig are never null

Modified:
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/config/SocketConfig.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOReactorConfig.java

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/config/SocketConfig.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/config/SocketConfig.java?rev=1789821&r1=1789820&r2=1789821&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/config/SocketConfig.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/config/SocketConfig.java
Sat Apr  1 17:10:42 2017
@@ -249,8 +249,15 @@ public class SocketConfig {
         private int backlogSize;
 
         Builder() {
+            this.connectTimeout = TimeValue.ZERO_MILLIS;
+            this.soTimeout = TimeValue.ZERO_MILLIS;
+            this.soReuseAddress = false;
             this.soLinger = TimeValue.NEG_ONE_SECONDS;
+            this.soKeepAlive = false;
             this.tcpNoDelay = true;
+            this.sndBufSize = 0;
+            this.rcvBufSize = 0;
+            this.backlogSize = 0;
         }
 
         /**
@@ -329,7 +336,11 @@ public class SocketConfig {
         }
 
         public SocketConfig build() {
-            return new SocketConfig(connectTimeout, soTimeout, soReuseAddress, soLinger,
+            return new SocketConfig(
+                    connectTimeout != null ? connectTimeout : TimeValue.ZERO_MILLIS,
+                    soTimeout != null ? soTimeout : TimeValue.ZERO_MILLIS,
+                    soReuseAddress,
+                    soLinger != null ? soLinger : TimeValue.NEG_ONE_SECONDS,
                     soKeepAlive, tcpNoDelay, sndBufSize, rcvBufSize, backlogSize);
         }
 

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOReactorConfig.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOReactorConfig.java?rev=1789821&r1=1789820&r2=1789821&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOReactorConfig.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOReactorConfig.java
Sat Apr  1 17:10:42 2017
@@ -326,8 +326,14 @@ public final class IOReactorConfig {
 
         public IOReactorConfig build() {
             return new IOReactorConfig(
-                    selectInterval, ioThreadCount, soTimeout, soReuseAddress, soLinger, soKeepAlive,
tcpNoDelay,
-                    connectTimeout, sndBufSize, rcvBufSize, backlogSize);
+                    selectInterval, ioThreadCount,
+                    connectTimeout != null ? connectTimeout : TimeValue.ZERO_MILLIS,
+                    soReuseAddress,
+                    soLinger != null ? soLinger : TimeValue.NEG_ONE_SECONDS,
+                    soKeepAlive,
+                    tcpNoDelay,
+                    soTimeout != null ? soTimeout : TimeValue.ZERO_MILLIS,
+                    sndBufSize, rcvBufSize, backlogSize);
         }
 
     }



Mime
View raw message