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
This commit is contained in:
Gaston Dombiak 2004-09-24 02:12:47 +00:00 committed by gdombiak
parent 5ab0c1b7e7
commit aaf6cf0ca9
1 changed files with 7 additions and 0 deletions

View File

@ -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;
}