<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent changes to 24: BasicMessenger#sendText(Email, String)</title><link href="https://sourceforge.net/p/java-jml/bugs/24/" rel="alternate"/><link href="https://sourceforge.net/p/java-jml/bugs/24/feed.atom" rel="self"/><id>https://sourceforge.net/p/java-jml/bugs/24/</id><updated>2009-02-12T12:09:58Z</updated><subtitle>Recent changes to 24: BasicMessenger#sendText(Email, String)</subtitle><entry><title>BasicMessenger#sendText(Email, String)</title><link href="https://sourceforge.net/p/java-jml/bugs/24/" rel="alternate"/><published>2009-02-12T12:09:58Z</published><updated>2009-02-12T12:09:58Z</updated><author><name>zhiye xie</name><uri>https://sourceforge.net/u/jimuzhiye/</uri></author><id>https://sourceforge.net1f9cc570fe8150c8fb3444daf3cf73528669eb89</id><summary type="html">&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;</summary></entry></feed>