<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to 24: BasicMessenger#sendText(Email, String)</title><link>https://sourceforge.net/p/java-jml/bugs/24/</link><description>Recent changes to 24: BasicMessenger#sendText(Email, String)</description><atom:link href="https://sourceforge.net/p/java-jml/bugs/24/feed.rss" rel="self"/><language>en</language><lastBuildDate>Thu, 12 Feb 2009 12:09:58 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/java-jml/bugs/24/feed.rss" rel="self" type="application/rss+xml"/><item><title>BasicMessenger#sendText(Email, String)</title><link>https://sourceforge.net/p/java-jml/bugs/24/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;hi all,&lt;br /&gt;
if I send serveral messages at the beginning, the msn cannot receive messages. I debugged BasicMessenger#sendText(Email, String) and got what was the matter.&lt;/p&gt;
&lt;p&gt;public void sendText(final Email email, final String text) {&lt;br /&gt;
if (email == null || text == null)&lt;br /&gt;
return;&lt;br /&gt;
MsnSwitchboard[] switchboards = getActiveSwitchboards();&lt;br /&gt;
for (MsnSwitchboard switchboard1 : switchboards) {&lt;br /&gt;
if (switchboard1.containContact(email)&lt;br /&gt;
&amp;amp;&amp;amp; switchboard1.getAllContacts().length == 1) {&lt;br /&gt;
switchboard1.sendText(text);&lt;br /&gt;
return;&lt;br /&gt;
}&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;final Object attachment = new Object();&lt;br /&gt;
addSwitchboardListener(new MsnSwitchboardAdapter() {&lt;/p&gt;
&lt;p&gt;@Override&lt;br /&gt;
public void switchboardStarted(MsnSwitchboard switchboard) {&lt;br /&gt;
if (switchboard.getAttachment() == attachment) {&lt;br /&gt;
switchboard.inviteContact(email);&lt;br /&gt;
}&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;@Override&lt;br /&gt;
public void contactJoinSwitchboard(MsnSwitchboard switchboard,&lt;br /&gt;
MsnContact contact) {&lt;br /&gt;
if (switchboard.getAttachment() == attachment&lt;br /&gt;
&amp;amp;&amp;amp; email.equals(contact.getEmail())) {&lt;br /&gt;
switchboard.setAttachment(null);&lt;br /&gt;
removeSwitchboardListener(this);&lt;br /&gt;
switchboard.sendText(text);&lt;br /&gt;
}&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;});&lt;br /&gt;
newSwitchboard(attachment);&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;each time the last line "newSwitchboard(attachment) is called, the attachment of switchboard will changed, so switchboard.getAttachment() == attachment always causes false.&lt;/p&gt;
&lt;p&gt;so I removed switchboard.getAttachment() == attachment in switchboardStarted and contactJoinSwitchboard, then the BasicMessenger#sendText(Email, String) works fine.&lt;/p&gt;
&lt;p&gt;But I wonder whether this modification will cause another bugs.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">zhiye xie</dc:creator><pubDate>Thu, 12 Feb 2009 12:09:58 -0000</pubDate><guid>https://sourceforge.net1f9cc570fe8150c8fb3444daf3cf73528669eb89</guid></item></channel></rss>