Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Erdfelt2014-05-09 18:23:57 +0000
committerJoakim Erdfelt2014-05-09 18:23:57 +0000
commit8521a7875a0624a7aa49482b57255ef3294c5ee2 (patch)
treed9ad8f9e5d5139ee29b4bf6d0272176433d40c0d /jetty-websocket/websocket-api/src
parent88a1512d44046542426a860115240dd542a8ff2c (diff)
downloadorg.eclipse.jetty.project-8521a7875a0624a7aa49482b57255ef3294c5ee2.tar.gz
org.eclipse.jetty.project-8521a7875a0624a7aa49482b57255ef3294c5ee2.tar.xz
org.eclipse.jetty.project-8521a7875a0624a7aa49482b57255ef3294c5ee2.zip
433405 - Websocket Session.setMaxIdleTimeout fails with zero
+ Make idle timeout check not fail on 0 (which is valid)
Diffstat (limited to 'jetty-websocket/websocket-api/src')
-rw-r--r--jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketPolicy.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketPolicy.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketPolicy.java
index 12edcce9b7..083cfe1701 100644
--- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketPolicy.java
+++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketPolicy.java
@@ -110,11 +110,11 @@ public class WebSocketPolicy
}
}
- private void assertPositive(String name, long size)
+ private void assertGreaterThan(String name, long size, long minSize)
{
- if (size < 1)
+ if (size < minSize)
{
- throw new IllegalArgumentException(String.format("%s [%d] must be a postive value larger than 0",name,size));
+ throw new IllegalArgumentException(String.format("%s [%d] must be a greater than or equal to " + minSize,name,size));
}
}
@@ -260,7 +260,7 @@ public class WebSocketPolicy
*/
public void setIdleTimeout(long ms)
{
- assertPositive("IdleTimeout",ms);
+ assertGreaterThan("IdleTimeout",ms,0);
this.idleTimeout = ms;
}
@@ -272,7 +272,7 @@ public class WebSocketPolicy
*/
public void setInputBufferSize(int size)
{
- assertPositive("InputBufferSize",size);
+ assertGreaterThan("InputBufferSize",size,1);
assertLessThan("InputBufferSize",size,"MaxTextMessageBufferSize",maxTextMessageBufferSize);
assertLessThan("InputBufferSize",size,"MaxBinaryMessageBufferSize",maxBinaryMessageBufferSize);
@@ -289,7 +289,7 @@ public class WebSocketPolicy
*/
public void setMaxBinaryMessageBufferSize(int size)
{
- assertPositive("MaxBinaryMessageBufferSize",size);
+ assertGreaterThan("MaxBinaryMessageBufferSize",size,1);
this.maxBinaryMessageBufferSize = size;
}
@@ -304,7 +304,7 @@ public class WebSocketPolicy
*/
public void setMaxBinaryMessageSize(int size)
{
- assertPositive("MaxBinaryMessageSize",size);
+ assertGreaterThan("MaxBinaryMessageSize",size,1);
this.maxBinaryMessageSize = size;
}
@@ -319,7 +319,7 @@ public class WebSocketPolicy
*/
public void setMaxTextMessageBufferSize(int size)
{
- assertPositive("MaxTextMessageBufferSize",size);
+ assertGreaterThan("MaxTextMessageBufferSize",size,1);
this.maxTextMessageBufferSize = size;
}
@@ -334,7 +334,7 @@ public class WebSocketPolicy
*/
public void setMaxTextMessageSize(int size)
{
- assertPositive("MaxTextMessageSize",size);
+ assertGreaterThan("MaxTextMessageSize",size,1);
this.maxTextMessageSize = size;
}

Back to the top