From aaf6cf0ca96ce932580255616046a486d124a197 Mon Sep 17 00:00:00 2001 From: Gaston Dombiak Date: Fri, 24 Sep 2004 02:12:47 +0000 Subject: [PATCH] Adds security checks to ensure that PacketReplyTime is always greater than 0. git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2384 b35dd754-fafc-0310-a699-88a17e54d16e --- source/org/jivesoftware/smack/SmackConfiguration.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/org/jivesoftware/smack/SmackConfiguration.java b/source/org/jivesoftware/smack/SmackConfiguration.java index 9c0d95ffe..efc4f20e7 100644 --- a/source/org/jivesoftware/smack/SmackConfiguration.java +++ b/source/org/jivesoftware/smack/SmackConfiguration.java @@ -158,6 +158,10 @@ public final class SmackConfiguration { * @return the milliseconds to wait for a response from the server */ public static int getPacketReplyTimeout() { + // The timeout value must be greater than 0 otherwise we will answer the default value + if (packetReplyTimeout <= 0) { + packetReplyTimeout = 5000; + } return packetReplyTimeout; } @@ -168,6 +172,9 @@ public final class SmackConfiguration { * @param timeout the milliseconds to wait for a response from the server */ public static void setPacketReplyTimeout(int timeout) { + if (timeout <= 0) { + throw new IllegalArgumentException(); + } packetReplyTimeout = timeout; }