Fixed potential endless loop.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@4527 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2006-07-17 19:38:37 +00:00 committed by gato
parent 0e1c037504
commit f520dfe02e
1 changed files with 3 additions and 2 deletions

View File

@ -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)) {