Permalink
Browse files

NEXUS-5368: Enforcing correct parameter

  • Loading branch information...
1 parent b38af77 commit ffd25cce6637afedf1badeffe768df84f33d829b @cstamas cstamas committed Nov 22, 2012
@@ -15,6 +15,7 @@
import org.apache.http.HttpResponse;
import org.apache.http.impl.client.DefaultConnectionKeepAliveStrategy;
import org.apache.http.protocol.HttpContext;
+import com.google.common.base.Preconditions;
/**
* Nexus connection keep alive strategy, that differs from the HC4 default one only in one thing: when server does
@@ -36,10 +37,13 @@
/**
* Constructor.
*
- * @param maxKeepAliveDuration the max duration in millis for how long to pool the connection.
+ * @param maxKeepAliveDuration the max duration in millis for how long to pool the connection.
*/
public NexusConnectionKeepAliveStrategy( final long maxKeepAliveDuration )
{
+ Preconditions.checkArgument( maxKeepAliveDuration > -1,
+ "maxKeepAliveDuration must be 0 or higher, but is set to %s",
+ maxKeepAliveDuration );
this.maxKeepAliveDuration = maxKeepAliveDuration;
}

0 comments on commit ffd25cc

Please sign in to comment.