Fixes programming errors detected by FindBugs.

cusax-fix
Lyubomir Marinov 17 years ago
parent bfce580dcf
commit c9ec9e11c6

@ -12,7 +12,7 @@
import net.kano.joustsim.oscar.oscar.service.ssi.*;
/**
* The ICQ implementation of the ContactGroup interface. Intances of this class
* The ICQ implementation of the ContactGroup interface. Instances of this class
* (contrary to <tt>RootContactGroupIcqImpl</tt>) may only contain buddies
* and cannot have sub groups. Note that instances of this class only use the
* corresponding joust sim source group for reading their names and only
@ -33,7 +33,7 @@ public class ContactGroupIcqImpl
* strings in the left column because screen names in AIM/ICQ are not case
* sensitive.
*/
private Map<String, Contact> buddies
private final Map<String, Contact> buddies
= new Hashtable<String, Contact>();
private boolean isResolved = false;
@ -71,7 +71,7 @@ public class ContactGroupIcqImpl
* to directly compare ( == ) instances of buddies we've stored and others
* that are returned by the framework.
* <p>
* @param joustSimGroup the JoustSIM Group correspoinding to the group
* @param joustSimGroup the JoustSIM Group corresponding to the group
* @param groupMembers the group members that we should add to the group.
* @param ssclCallback a callback to the server stored contact list
* we're creating.
@ -153,16 +153,25 @@ void addContact(ContactIcqImpl contact)
*/
void removeContact(ContactIcqImpl contact)
{
buddies.remove(contact);
for (Iterator<Map.Entry<String, Contact>> buddyIter
= buddies.entrySet().iterator();
buddyIter.hasNext();)
{
if (buddyIter.next().getKey().equals(contact))
{
buddyIter.remove();
break;
}
}
}
/**
* Returns an Iterator over all contacts, member of this
* <tt>ContactGroup</tt>.
*
*
* @return a java.util.Iterator over all contacts inside this
* <tt>ContactGroup</tt>. In case the group doesn't contain any
* memebers it will return an empty iterator.
* <tt>ContactGroup</tt>. In case the group doesn't contain any
* members it will return an empty iterator.
*/
public Iterator<Contact> contacts()
{
@ -368,7 +377,7 @@ int findContactIndex(Contact contact)
/**
* Returns the icq contact encapsulating with the spcieified screen name or
* Returns the icq contact encapsulating with the specified screen name or
* null if no such contact was found.
*
* @param screenName the screenName (or icq UIN) for the contact we're

@ -1657,9 +1657,16 @@ public boolean authorizationRequired(Screenname screenname, Group parentGroup)
((ContactGroupIcqImpl)parent).removeContact(srcContact);
theAwaitingAuthorizationGroup.addContact(srcContact);
Object lock = new Object();
synchronized(lock){
try{ lock.wait(500); }catch(Exception e){}
try
{
Thread.sleep(500);
}
catch (InterruptedException ex)
{
/*
* I don't know why the exception is ignored, I just fixed
* an incorrect use of Object.wait(long).
*/
}
fireSubscriptionMovedEvent(srcContact,

@ -14,6 +14,7 @@
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
@ -243,15 +244,15 @@ public void actionPerformed(ActionEvent event)
/**
* Fills the Account ID, Identity File and Known Hosts File fields in this
* panel with the data comming from the given protocolProvider.
* panel with the data coming from the given protocolProvider.
*
* @param protocolProvider The <tt>ProtocolProviderService</tt> to load the
* data from.
*/
public void loadAccount(ProtocolProviderService protocolProvider)
{
ProtocolProviderFactorySSH protocolProviderSSH =
(ProtocolProviderFactorySSH)protocolProvider;
if (!(protocolProvider instanceof ProtocolProviderServiceSSHImpl))
throw new ClassCastException("protocolProvider");
AccountID accountID = protocolProvider.getAccountID();

Loading…
Cancel
Save