ARTEMIS-2320 'while' statement does not loop

This commit is contained in:
Jiri Danek 2019-04-25 16:14:27 +02:00 committed by Michael Andre Pearce
parent b33874488b
commit 781e4c460d
2 changed files with 13 additions and 19 deletions

View File

@ -3748,16 +3748,12 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
}
}
while (true) {
if (messagesIterator != null && messagesIterator.hasNext()) {
MessageReference msg = messagesIterator.next();
if (msg.isPaged()) {
previouslyBrowsed.add(((PagedReference) msg).getPosition());
}
return msg;
} else {
break;
if (messagesIterator != null && messagesIterator.hasNext()) {
MessageReference msg = messagesIterator.next();
if (msg.isPaged()) {
previouslyBrowsed.add(((PagedReference) msg).getPosition());
}
return msg;
}
if (getPagingIterator() != null) {
while (getPagingIterator().hasNext()) {

View File

@ -48,16 +48,14 @@ public class SpawnedJMSServer {
System.out.println("OK");
String line = null;
while ((line = br.readLine()) != null) {
if ("STOP".equals(line.trim())) {
stopServer();
System.out.println("Server stopped");
System.exit(0);
} else {
// stop anyway but with an error status
System.exit(1);
}
String line = br.readLine();
if (line != null && "STOP".equals(line.trim())) {
stopServer();
System.out.println("Server stopped");
System.exit(0);
} else {
// stop anyway but with an error status
System.exit(1);
}
} catch (Throwable t) {
t.printStackTrace();