Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

My iter.hasNext() is not iterating correctly

Status
Not open for further replies.

Ngai88

Programmer
Sep 8, 2004
56
US
Hello,
In the drop down box list , I selected 'Transportation' as PrimaryRecipient. Then below it on the checkboxes I checked 'Agriculture', 'Command', 'Direction and Control' as my choices.

4 choices:
Transportation ( primaryRecipient)
Agriculture
Command
Direction and Control

when I compile my page, I do not see the 4 choices,
I see only 3,

Transportation
Command
Direction and Control

I am missing 'Agriculture' ......

It should show the choices in this order ...

Transportation
Agriculture
Command
Direction and Control

Can someone tell where I mess up?
I included the code and the logs.

Thanks,
Ngai



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
private String getRecipientsBR(MsgComposeBean msg) {
if(msg == null) { return null; }
List recipientList = msg.getMsgRecipients();
if(recipientList.isEmpty()) { return null; }


Iterator iter = recipientList.iterator();

StringBuffer sbRecipients = new StringBuffer(msg.getPrimaryRecipient());

log.debug("CHK 1......sbRecipients:" + sbRecipients.toString()); // got the primary recipient


//if more recipients, add <BR> and next recipient
String RECIPIENT ="";

while (iter.hasNext()) {

RECIPIENT = (String)iter.next();
log.debug("CHK 2......got subsequebt RECIPIENT: " + RECIPIENT); // got the subsequent recipient

if(!RECIPIENT.equalsIgnoreCase(msg.getPrimaryRecipient())){

sbRecipients.append(HTML_BR).append((String)iter.next());
// got the subsequent recipient
log.debug("CHK 3......sbRecipients.append(HTML_BR).append((String)iter.next()): "+sbRecipients.append(HTML_BR).append((String)iter.next()));
}
}

log.debug("CHK 4...sbRecipients list with breaks\n" + sbRecipients.toString());

return sbRecipients.toString();

}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Logs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2004-11-01 16:40:13,046 DEBUG [HttpProcessor[8080][4]] controller.MessageComposeController.java:1331)) - CHK 1......sbRecipients:Transportation

2004-11-01 16:40:13,046 DEBUG [HttpProcessor[8080][4]] controller.MessageComposeController.java:1331)) - CHK 1......sbRecipients:Transportation

2004-11-01 16:40:13,046 DEBUG [HttpProcessor[8080][4]] controller.MessageComposeController.java:1344)) - CHK 2......got subsequent RECIPIENT: Agriculture

2004-11-01 16:40:13,046 DEBUG [HttpProcessor[8080][4]] controller.MessageComposeController.java:1344)) - CHK 2......got subsequent RECIPIENT: Agriculture

2004-11-01 16:40:13,046 DEBUG [HttpProcessor[8080][4]] controller.MessageComposeController.java:1349)) - CHK 3......sbRecipients.append(HTML_BR).append((String)iter.next()): Transportation<br>Command<br>Direction and Control

2004-11-01 16:40:13,046 DEBUG [HttpProcessor[8080][4]] controller.MessageComposeController.java:1349)) - CHK 3......sbRecipients.append(HTML_BR).append((String)iter.next()): Transportation<br>Command<br>Direction and Control

2004-11-01 16:40:13,046 DEBUG [HttpProcessor[8080][4]] controller.MessageComposeController.java:1344)) - CHK 2......got subsequebt RECIPIENT: Transportation

2004-11-01 16:40:13,046 DEBUG [HttpProcessor[8080][4]] controller.MessageComposeController.java:1344)) - CHK 2......got subsequebt RECIPIENT: Transportation

2004-11-01 16:40:13,046 DEBUG [HttpProcessor[8080][4]] controller.MessageComposeController.java:1353)) - CHK 4...sbRecipients list with breaks
Transportation<br>Command<br>Direction and Control

2004-11-01 16:40:13,046 DEBUG [HttpProcessor[8080][4]] controller.MessageComposeController.java:1353)) - CHK 4...sbRecipients list with breaks
Transportation<br>Command<br>Direction and Control
 
I figure it out, thanks anyway.

Ngai
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top