From f520dfe02eea2b1a689d8c349a8f39944254688a Mon Sep 17 00:00:00 2001 From: Gaston Dombiak Date: Mon, 17 Jul 2006 19:38:37 +0000 Subject: [PATCH] Fixed potential endless loop. git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@4527 b35dd754-fafc-0310-a699-88a17e54d16e --- test/org/jivesoftware/smack/RosterTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/org/jivesoftware/smack/RosterTest.java b/test/org/jivesoftware/smack/RosterTest.java index 56348289f..cab15c917 100644 --- a/test/org/jivesoftware/smack/RosterTest.java +++ b/test/org/jivesoftware/smack/RosterTest.java @@ -88,7 +88,8 @@ public class RosterTest extends SmackTestCase { roster.createEntry(getBareJID(2), "gato12", new String[] { "Family" }); // Wait until the server confirms the new entries - while (roster.getEntryCount() != 2) { + long initial = System.currentTimeMillis(); + while (System.currentTimeMillis() - initial < 2000 && roster.getEntryCount() != 2) { Thread.sleep(50); } @@ -98,7 +99,7 @@ public class RosterTest extends SmackTestCase { } } // Wait up to 2 seconds - long initial = System.currentTimeMillis(); + initial = System.currentTimeMillis(); while (System.currentTimeMillis() - initial < 2000 && (roster.getGroupCount() != 0 && getConnection(2).getRoster().getEntryCount() != 2)) {