diff options
author | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2009-08-31 13:15:22 +0000 |
---|---|---|
committer | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2009-08-31 13:15:22 +0000 |
commit | d84529346a391f3fd33d3bff5ebb808a837429d3 (patch) | |
tree | 85e3fb45421099bf6fe6429f491c13e185c5f85b /src/net/java | |
parent | 45e152d9b19a7ebd4dcd3cb0631a4cc3f283ba2a (diff) | |
download | jitsi-d84529346a391f3fd33d3bff5ebb808a837429d3.zip jitsi-d84529346a391f3fd33d3bff5ebb808a837429d3.tar.gz jitsi-d84529346a391f3fd33d3bff5ebb808a837429d3.tar.bz2 |
Commits another part of the patch provided by Sebastien Vincent on the dev mailing list in an e-mail with the subject "Fix lot of warnings in the code" which fixes warnings in the src directory.
Diffstat (limited to 'src/net/java')
109 files changed, 799 insertions, 997 deletions
diff --git a/src/net/java/sip/communicator/impl/configuration/xml/XMLConfigurationStore.java b/src/net/java/sip/communicator/impl/configuration/xml/XMLConfigurationStore.java index 89d883f..7e80aa5 100644 --- a/src/net/java/sip/communicator/impl/configuration/xml/XMLConfigurationStore.java +++ b/src/net/java/sip/communicator/impl/configuration/xml/XMLConfigurationStore.java @@ -68,17 +68,24 @@ public class XMLConfigurationStore * Returns a copy of the Map containing all configuration properties
* @return a Map clone of the current configuration property set.
*/
+ @SuppressWarnings("unchecked")
private Map<String, Object> cloneProperties()
{
// at the time I'm writing this method we're implementing the
// configuration service through the use of a hashtable. this may very
// well change one day so let's not be presumptuous
if (properties instanceof Hashtable)
- return (Map<String, Object>) ((Hashtable) properties).clone();
+ return
+ (Map<String, Object>)
+ ((Hashtable<String, Object>) properties).clone();
if (properties instanceof HashMap)
- return (Map<String, Object>) ((HashMap) properties).clone();
+ return
+ (Map<String, Object>)
+ ((HashMap<String, Object>) properties).clone();
if (properties instanceof TreeMap)
- return (Map<String, Object>) ((TreeMap) properties).clone();
+ return
+ (Map<String, Object>)
+ ((TreeMap<String, Object>) properties).clone();
// well you can't say that I didn't try!!!
diff --git a/src/net/java/sip/communicator/impl/filehistory/FileHistoryServiceImpl.java b/src/net/java/sip/communicator/impl/filehistory/FileHistoryServiceImpl.java index aacc98a..b8af9ca 100644 --- a/src/net/java/sip/communicator/impl/filehistory/FileHistoryServiceImpl.java +++ b/src/net/java/sip/communicator/impl/filehistory/FileHistoryServiceImpl.java @@ -860,12 +860,12 @@ public class FileHistoryServiceImpl * and to be ordered in TreeSet according their timestamp */ private static class FileRecordComparator - implements Comparator + implements Comparator<FileRecord> { - public int compare(Object o1, Object o2) + public int compare(FileRecord o1, FileRecord o2) { - long date1 = ((FileRecord)o1).getDate(); - long date2 = ((FileRecord)o2).getDate(); + long date1 = o1.getDate(); + long date2 = o2.getDate(); return (date1 < date2) ? -1 : ((date1 == date2) ? 0 : 1); } diff --git a/src/net/java/sip/communicator/impl/growlnotification/GrowlNotificationServiceImpl.java b/src/net/java/sip/communicator/impl/growlnotification/GrowlNotificationServiceImpl.java index 78f2ebd..39ba353 100644 --- a/src/net/java/sip/communicator/impl/growlnotification/GrowlNotificationServiceImpl.java +++ b/src/net/java/sip/communicator/impl/growlnotification/GrowlNotificationServiceImpl.java @@ -177,7 +177,7 @@ public class GrowlNotificationServiceImpl */ public void growlNotificationTimedOut(Object context) { - PopupMessage m = (PopupMessage)shownPopups.get(context); + PopupMessage m = shownPopups.get(context); if (m != null) { synchronized(shownPopups) { shownPopups.remove(context); @@ -194,7 +194,7 @@ public class GrowlNotificationServiceImpl */ public void growlNotificationWasClicked(Object context) { - PopupMessage m = (PopupMessage)shownPopups.get(context); + PopupMessage m = shownPopups.get(context); if (m != null) { synchronized(shownPopups) { shownPopups.remove(context); diff --git a/src/net/java/sip/communicator/impl/gui/main/account/AccountList.java b/src/net/java/sip/communicator/impl/gui/main/account/AccountList.java index 6106f3e..d5e7eea 100644 --- a/src/net/java/sip/communicator/impl/gui/main/account/AccountList.java +++ b/src/net/java/sip/communicator/impl/gui/main/account/AccountList.java @@ -106,19 +106,7 @@ public class AccountList */ public void providerStatusChanged(ProviderPresenceStatusChangeEvent evt) { - ProtocolProviderService protocolProvider = evt.getProvider(); - - Enumeration<Account> accounts - = (Enumeration<Account>) accountListModel.elements(); - while (accounts.hasMoreElements()) - { - Account account = accounts.nextElement(); - - if (account.getProtocolProvider().equals(protocolProvider)) - { - accountListModel.contentChanged(account); - } - } + accountListModelContentChanged(evt.getProvider()); } public void providerStatusMessageChanged(PropertyChangeEvent evt) {} @@ -178,16 +166,14 @@ public class AccountList } else if (event.getType() == ServiceEvent.UNREGISTERING) { - Enumeration<Account> accounts - = (Enumeration<Account>) accountListModel.elements(); - while (accounts.hasMoreElements()) + Object[] accountListModelElements = accountListModel.toArray(); + + for (Object accountListModelElement : accountListModelElements) { - Account account = accounts.nextElement(); + Account account = (Account) accountListModelElement; if (account.getProtocolProvider().equals(protocolProvider)) - { accountListModel.removeElement(account); - } } } } @@ -220,18 +206,28 @@ public class AccountList */ public void registrationStateChanged(RegistrationStateChangeEvent evt) { - ProtocolProviderService protocolProvider = evt.getProvider(); + accountListModelContentChanged(evt.getProvider()); + } + + /** + * Notifies <code>accountListModel</code> that the <code>Account</code>s of + * a specific <code>ProtocolProviderService</code> have changed. + * + * @param protocolProvider + * the <code>ProtocolProviderService</code> which had its + * <code>Account</code>s changed + */ + private void accountListModelContentChanged( + ProtocolProviderService protocolProvider) + { + Enumeration<?> accounts = accountListModel.elements(); - Enumeration<Account> accounts - = (Enumeration<Account>) accountListModel.elements(); while (accounts.hasMoreElements()) { - Account account = accounts.nextElement(); + Account account = (Account) accounts.nextElement(); if (account.getProtocolProvider().equals(protocolProvider)) - { accountListModel.contentChanged(account); - } } } @@ -239,7 +235,8 @@ public class AccountList * A custom list model that allows us to refresh the content of a single * row. */ - private class AccountListModel extends DefaultListModel + private class AccountListModel + extends DefaultListModel { public void contentChanged(Account account) { diff --git a/src/net/java/sip/communicator/impl/metahistory/MetaHistoryServiceImpl.java b/src/net/java/sip/communicator/impl/metahistory/MetaHistoryServiceImpl.java index 235f965..aa8b5b5 100644 --- a/src/net/java/sip/communicator/impl/metahistory/MetaHistoryServiceImpl.java +++ b/src/net/java/sip/communicator/impl/metahistory/MetaHistoryServiceImpl.java @@ -49,8 +49,8 @@ public class MetaHistoryServiceImpl */ private Hashtable<String, Object> services = new Hashtable<String, Object>(); - private ArrayList<HistorySearchProgressListener> - progressListeners = new ArrayList<HistorySearchProgressListener>(); + private final List<HistorySearchProgressListener> progressListeners + = new ArrayList<HistorySearchProgressListener>(); /** * Returns all the records for the descriptor after the given date. @@ -59,7 +59,7 @@ public class MetaHistoryServiceImpl * @param descriptor CallPeer address(String), * MetaContact or ChatRoom. * @param startDate Date the date of the first record to return - * @return Collection sorted result that conists of records returned from + * @return Collection sorted result that consists of records returned from * the services we wrap * @throws RuntimeException */ @@ -67,10 +67,10 @@ public class MetaHistoryServiceImpl Object descriptor, Date startDate) throws RuntimeException { - MessageProgressWrapper listenWrapper = - new MessageProgressWrapper(progressListeners, services.length); + MessageProgressWrapper listenWrapper + = new MessageProgressWrapper(services.length); - TreeSet result = new TreeSet(new RecordsComparator()); + TreeSet<Object> result = new TreeSet<Object>(new RecordsComparator()); for (int i = 0; i < services.length; i++) { String name = services[i]; @@ -130,10 +130,10 @@ public class MetaHistoryServiceImpl Object descriptor, Date endDate) throws RuntimeException { - MessageProgressWrapper listenWrapper = - new MessageProgressWrapper(progressListeners, services.length); + MessageProgressWrapper listenWrapper + = new MessageProgressWrapper(services.length); - TreeSet result = new TreeSet(new RecordsComparator()); + TreeSet<Object> result = new TreeSet<Object>(new RecordsComparator()); for (int i = 0; i < services.length; i++) { String name = services[i]; @@ -195,10 +195,10 @@ public class MetaHistoryServiceImpl Object descriptor, Date startDate, Date endDate) throws RuntimeException { - MessageProgressWrapper listenWrapper = - new MessageProgressWrapper(progressListeners, services.length); + MessageProgressWrapper listenWrapper + = new MessageProgressWrapper(services.length); - TreeSet result = new TreeSet(new RecordsComparator()); + TreeSet<Object> result = new TreeSet<Object>(new RecordsComparator()); for (int i = 0; i < services.length; i++) { String name = services[i]; @@ -287,10 +287,10 @@ public class MetaHistoryServiceImpl String[] keywords, boolean caseSensitive) throws RuntimeException { - MessageProgressWrapper listenWrapper = - new MessageProgressWrapper(progressListeners, services.length); + MessageProgressWrapper listenWrapper + = new MessageProgressWrapper(services.length); - TreeSet result = new TreeSet(new RecordsComparator()); + TreeSet<Object> result = new TreeSet<Object>(new RecordsComparator()); for (int i = 0; i < services.length; i++) { String name = services[i]; @@ -426,10 +426,10 @@ public class MetaHistoryServiceImpl Object descriptor, String[] keywords, boolean caseSensitive) throws RuntimeException { - MessageProgressWrapper listenWrapper = - new MessageProgressWrapper(progressListeners, services.length); + MessageProgressWrapper listenWrapper + = new MessageProgressWrapper(services.length); - TreeSet result = new TreeSet(new RecordsComparator()); + TreeSet<Object> result = new TreeSet<Object>(new RecordsComparator()); for (int i = 0; i < services.length; i++) { String name = services[i]; @@ -506,10 +506,10 @@ public class MetaHistoryServiceImpl Object descriptor, int count) throws RuntimeException { - MessageProgressWrapper listenWrapper = - new MessageProgressWrapper(progressListeners, services.length); + MessageProgressWrapper listenWrapper + = new MessageProgressWrapper(services.length); - TreeSet result = new TreeSet(new RecordsComparator()); + TreeSet<Object> result = new TreeSet<Object>(new RecordsComparator()); for (int i = 0; i < services.length; i++) { String name = services[i]; @@ -557,7 +557,7 @@ public class MetaHistoryServiceImpl } listenWrapper.fireLastProgress(null, null, null); - LinkedList resultAsList = new LinkedList(result); + LinkedList<Object> resultAsList = new LinkedList<Object>(result); int startIndex = resultAsList.size() - count; if(startIndex < 0) @@ -582,10 +582,10 @@ public class MetaHistoryServiceImpl Object descriptor, Date date, int count) throws RuntimeException { - MessageProgressWrapper listenWrapper = - new MessageProgressWrapper(progressListeners, services.length); + MessageProgressWrapper listenWrapper + = new MessageProgressWrapper(services.length); - TreeSet result = new TreeSet(new RecordsComparator()); + TreeSet<Object> result = new TreeSet<Object>(new RecordsComparator()); for (int i = 0; i < services.length; i++) { String name = services[i]; @@ -630,12 +630,12 @@ public class MetaHistoryServiceImpl listenWrapper.setIx(i); chs.addSearchProgressListener(listenWrapper); - Collection col = chs.findByStartDate(date); + Collection<CallRecord> col = chs.findByStartDate(date); if(col.size() > count) { // before we make a sublist make sure there are sorted in the // right order - List l = new LinkedList(col); + List<CallRecord> l = new LinkedList<CallRecord>(col); Collections.sort(l, new RecordsComparator()); result.addAll(l.subList(0, count)); } @@ -645,7 +645,7 @@ public class MetaHistoryServiceImpl } } listenWrapper.fireLastProgress(date, null, null); - LinkedList resultAsList = new LinkedList(result); + LinkedList<Object> resultAsList = new LinkedList<Object>(result); int toIndex = count; if(toIndex > resultAsList.size()) @@ -670,10 +670,10 @@ public class MetaHistoryServiceImpl Object descriptor, Date date, int count) throws RuntimeException { - MessageProgressWrapper listenWrapper = - new MessageProgressWrapper(progressListeners, services.length); + MessageProgressWrapper listenWrapper + = new MessageProgressWrapper(services.length); - TreeSet result = new TreeSet(new RecordsComparator()); + TreeSet<Object> result = new TreeSet<Object>(new RecordsComparator()); for (int i = 0; i < services.length; i++) { String name = services[i]; @@ -718,10 +718,10 @@ public class MetaHistoryServiceImpl listenWrapper.setIx(i); chs.addSearchProgressListener(listenWrapper); - Collection col = chs.findByEndDate(date); + Collection<CallRecord> col = chs.findByEndDate(date); if(col.size() > count) { - List l = new LinkedList(col); + List<CallRecord> l = new LinkedList<CallRecord>(col); result.addAll(l.subList(l.size() - count, l.size())); } else @@ -731,7 +731,7 @@ public class MetaHistoryServiceImpl } listenWrapper.fireLastProgress(date, null, null); - LinkedList resultAsList = new LinkedList(result); + LinkedList<Object> resultAsList = new LinkedList<Object>(result); int startIndex = resultAsList.size() - count; if(startIndex < 0) @@ -783,13 +783,10 @@ public class MetaHistoryServiceImpl private boolean matchAnyCallPeer( List<CallPeerRecord> cps, String[] keywords, boolean caseSensitive) { - Iterator<CallPeerRecord> iter = cps.iterator(); - while (iter.hasNext()) + for (CallPeerRecord callPeer : cps) { - CallPeerRecord callPeer = iter.next(); - for (int i = 0; i < keywords.length; i++) + for (String k : keywords) { - String k = keywords[i]; if(caseSensitive && callPeer.getPeerAddress().contains(k)) return true; else if(callPeer.getPeerAddress().toLowerCase(). @@ -797,7 +794,6 @@ public class MetaHistoryServiceImpl return true; } } - return false; } @@ -889,7 +885,7 @@ public class MetaHistoryServiceImpl * to be ordered in TreeSet according their timestamp. */ private static class RecordsComparator - implements Comparator + implements Comparator<Object> { private long getDate(Object o) { @@ -922,15 +918,12 @@ public class MetaHistoryServiceImpl implements MessageHistorySearchProgressListener, CallHistorySearchProgressListener { - ArrayList<HistorySearchProgressListener> pListeners; - int ix; - int count; + private final int count; + + private int ix; - MessageProgressWrapper( - ArrayList<HistorySearchProgressListener> progressListeners, - int count) + public MessageProgressWrapper(int count) { - this.pListeners = progressListeners; this.count = count; } @@ -961,16 +954,15 @@ public class MetaHistoryServiceImpl private void fireEvent(ProgressEvent ev) { - Iterator<HistorySearchProgressListener> iter = null; + Iterable<HistorySearchProgressListener> listeners; synchronized(progressListeners) { - iter = new ArrayList(progressListeners).iterator(); - } - while (iter.hasNext()) - { - HistorySearchProgressListener hSearchProgListener = iter.next(); - hSearchProgListener.progressChanged(ev); + listeners + = new ArrayList<HistorySearchProgressListener>( + progressListeners); } + for (HistorySearchProgressListener listener : listeners) + listener.progressChanged(ev); } public void fireLastProgress( diff --git a/src/net/java/sip/communicator/impl/protocol/dict/DictAccountID.java b/src/net/java/sip/communicator/impl/protocol/dict/DictAccountID.java index 92f53e0..506a2b0 100644 --- a/src/net/java/sip/communicator/impl/protocol/dict/DictAccountID.java +++ b/src/net/java/sip/communicator/impl/protocol/dict/DictAccountID.java @@ -24,7 +24,7 @@ public class DictAccountID * @param userID the user identifier correspnding to the account * @param accountProperties any other properties necessary for the account. */ - DictAccountID(String userID, Map accountProperties) + DictAccountID(String userID, Map<String, String> accountProperties) { super(userID, accountProperties, ProtocolNames.DICT, "dict.org"); } diff --git a/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderFactoryDictImpl.java b/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderFactoryDictImpl.java index 7b2a821..ddba7b6 100644 --- a/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderFactoryDictImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderFactoryDictImpl.java @@ -47,7 +47,7 @@ public class ProtocolProviderFactoryDictImpl * @return the AccountID of the newly created account. */ public AccountID installAccount( String userIDStr, - Map accountProperties) + Map<String, String> accountProperties) { BundleContext context = DictActivator.getBundleContext(); if (context == null) @@ -89,7 +89,7 @@ public class ProtocolProviderFactoryDictImpl return accountID; } - protected AccountID createAccountID(String userID, Map accountProperties) + protected AccountID createAccountID(String userID, Map<String, String> accountProperties) { return new DictAccountID(userID, accountProperties); } diff --git a/src/net/java/sip/communicator/impl/protocol/facebook/ContactGroupFacebookImpl.java b/src/net/java/sip/communicator/impl/protocol/facebook/ContactGroupFacebookImpl.java index eca6f64..2566914 100644 --- a/src/net/java/sip/communicator/impl/protocol/facebook/ContactGroupFacebookImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/facebook/ContactGroupFacebookImpl.java @@ -315,7 +315,7 @@ public class ContactGroupFacebookImpl */
public ContactGroup getGroup(int index)
{
- return (ContactGroup)subGroups.get(index);
+ return subGroups.get(index);
}
/**
diff --git a/src/net/java/sip/communicator/impl/protocol/facebook/FacebookAccountID.java b/src/net/java/sip/communicator/impl/protocol/facebook/FacebookAccountID.java index e00bd0e..01aa11e 100644 --- a/src/net/java/sip/communicator/impl/protocol/facebook/FacebookAccountID.java +++ b/src/net/java/sip/communicator/impl/protocol/facebook/FacebookAccountID.java @@ -26,7 +26,7 @@ public class FacebookAccountID * @param accountProperties
* any other properties necessary for the account.
*/
- protected FacebookAccountID(String userID, Map accountProperties)
+ protected FacebookAccountID(String userID, Map<String, String> accountProperties)
{
super(
userID,
diff --git a/src/net/java/sip/communicator/impl/protocol/facebook/FacebookActivator.java b/src/net/java/sip/communicator/impl/protocol/facebook/FacebookActivator.java index f9d0da0..d52d163 100644 --- a/src/net/java/sip/communicator/impl/protocol/facebook/FacebookActivator.java +++ b/src/net/java/sip/communicator/impl/protocol/facebook/FacebookActivator.java @@ -58,7 +58,7 @@ public class FacebookActivator {
FacebookActivator.bundleContext = context;
- Hashtable hashtable = new Hashtable();
+ Hashtable<String, String> hashtable = new Hashtable<String, String>();
hashtable.put(ProtocolProviderFactory.PROTOCOL, "Facebook");
facebookProviderFactory = new ProtocolProviderFactoryFacebookImpl();
diff --git a/src/net/java/sip/communicator/impl/protocol/facebook/OperationSetPersistentPresenceFacebookImpl.java b/src/net/java/sip/communicator/impl/protocol/facebook/OperationSetPersistentPresenceFacebookImpl.java index aec505c..1e64b45 100644 --- a/src/net/java/sip/communicator/impl/protocol/facebook/OperationSetPersistentPresenceFacebookImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/facebook/OperationSetPersistentPresenceFacebookImpl.java @@ -446,7 +446,7 @@ public class OperationSetPersistentPresenceFacebookImpl while (subgroups.hasNext())
{
- ContactGroup subgroup = (ContactGroup) subgroups.next();
+ ContactGroup subgroup = subgroups.next();
changePresenceStatusForAllContacts(subgroup, newStatus);
}
}
diff --git a/src/net/java/sip/communicator/impl/protocol/facebook/OperationSetServerStoredContactInfoFacebookImpl.java b/src/net/java/sip/communicator/impl/protocol/facebook/OperationSetServerStoredContactInfoFacebookImpl.java index b289b4d..9788bc8 100644 --- a/src/net/java/sip/communicator/impl/protocol/facebook/OperationSetServerStoredContactInfoFacebookImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/facebook/OperationSetServerStoredContactInfoFacebookImpl.java @@ -401,4 +401,4 @@ public class OperationSetServerStoredContactInfoFacebookImpl } return byteArrayOS.toByteArray(); } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/impl/protocol/facebook/OperationSetSmsMessagingFacebookImpl.java b/src/net/java/sip/communicator/impl/protocol/facebook/OperationSetSmsMessagingFacebookImpl.java index cecc950..a3d535e 100644 --- a/src/net/java/sip/communicator/impl/protocol/facebook/OperationSetSmsMessagingFacebookImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/facebook/OperationSetSmsMessagingFacebookImpl.java @@ -218,19 +218,14 @@ public class OperationSetSmsMessagingFacebookImpl MessageDeliveredEvent evt =
new MessageDeliveredEvent(message, to);
- Iterator<MessageListener> listeners = null;
+ Iterable<MessageListener> listeners;
synchronized (messageListeners)
{
- listeners
- = new ArrayList<MessageListener>(messageListeners).iterator();
+ listeners = new ArrayList<MessageListener>(messageListeners);
}
- while (listeners.hasNext())
- {
- MessageListener listener = (MessageListener) listeners.next();
-
+ for (MessageListener listener : listeners)
listener.messageDelivered(evt);
- }
}
/**
@@ -244,18 +239,13 @@ public class OperationSetSmsMessagingFacebookImpl private void fireMessageDeliveryFailed(Message message, Contact to,
MessageDeliveryFailedEvent event)
{
- Iterator<MessageListener> listeners = null;
+ Iterable<MessageListener> listeners;
synchronized (messageListeners)
{
- listeners
- = new ArrayList<MessageListener>(messageListeners).iterator();
+ listeners = new ArrayList<MessageListener>(messageListeners);
}
- while (listeners.hasNext())
- {
- MessageListener listener = (MessageListener) listeners.next();
-
+ for (MessageListener listener : listeners)
listener.messageDeliveryFailed(event);
- }
}
}
diff --git a/src/net/java/sip/communicator/impl/protocol/facebook/ProtocolProviderFactoryFacebookImpl.java b/src/net/java/sip/communicator/impl/protocol/facebook/ProtocolProviderFactoryFacebookImpl.java index 1bd16bc..6d6e613 100644 --- a/src/net/java/sip/communicator/impl/protocol/facebook/ProtocolProviderFactoryFacebookImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/facebook/ProtocolProviderFactoryFacebookImpl.java @@ -136,8 +136,7 @@ public class ProtocolProviderFactoryFacebookImpl if (!registeredAccounts.containsKey(accountID))
return;
- ServiceRegistration registration =
- (ServiceRegistration) registeredAccounts.get(accountID);
+ ServiceRegistration registration = registeredAccounts.get(accountID);
// kill the service
if (registration != null)
@@ -162,7 +161,7 @@ public class ProtocolProviderFactoryFacebookImpl */
this.storeAccount(accountID);
- Hashtable properties = new Hashtable();
+ Hashtable<String, String> properties = new Hashtable<String, String>();
properties.put(PROTOCOL, ProtocolNames.FACEBOOK);
properties.put(USER_ID, accountID.getUserID());
diff --git a/src/net/java/sip/communicator/impl/protocol/facebook/ProtocolProviderServiceFacebookImpl.java b/src/net/java/sip/communicator/impl/protocol/facebook/ProtocolProviderServiceFacebookImpl.java index 715a2f0..fd452ee 100644 --- a/src/net/java/sip/communicator/impl/protocol/facebook/ProtocolProviderServiceFacebookImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/facebook/ProtocolProviderServiceFacebookImpl.java @@ -99,8 +99,7 @@ public class ProtocolProviderServiceFacebookImpl // initialize the IM operation set
OperationSetBasicInstantMessagingFacebookImpl basicInstantMessaging =
new OperationSetBasicInstantMessagingFacebookImpl(
- this,
- (OperationSetPersistentPresenceFacebookImpl) persistentPresence);
+ this, persistentPresence);
supportedOperationSets.put(OperationSetBasicInstantMessaging.class
.getName(), basicInstantMessaging);
@@ -108,8 +107,7 @@ public class ProtocolProviderServiceFacebookImpl // initialize the message operation set
OperationSetSmsMessagingFacebookImpl basicMessaging =
new OperationSetSmsMessagingFacebookImpl(
- this,
- (OperationSetPersistentPresenceFacebookImpl) persistentPresence);
+ this, persistentPresence);
supportedOperationSets.put(OperationSetSmsMessaging.class
.getName(), basicMessaging);
diff --git a/src/net/java/sip/communicator/impl/protocol/gibberish/ContactGroupGibberishImpl.java b/src/net/java/sip/communicator/impl/protocol/gibberish/ContactGroupGibberishImpl.java index f7ee909..38058e1 100644 --- a/src/net/java/sip/communicator/impl/protocol/gibberish/ContactGroupGibberishImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/gibberish/ContactGroupGibberishImpl.java @@ -32,12 +32,12 @@ public class ContactGroupGibberishImpl /** * The list of this group's members. */ - private Vector contacts = new Vector(); + private final List<Contact> contacts = new Vector<Contact>(); /** * The list of sub groups belonging to this group. */ - private Vector subGroups = new Vector(); + private final List<ContactGroup> subGroups = new Vector<ContactGroup>(); /** * The group that this group belongs to (or null if this is the root group). @@ -115,9 +115,9 @@ public class ContactGroupGibberishImpl * @return a java.util.Iterator over all contacts inside this * <tt>ContactGroup</tt> */ - public Iterator contacts() + public Iterator<Contact> contacts() { - return contacts.iterator(); + return this.contacts.iterator(); } /** @@ -206,7 +206,7 @@ public class ContactGroupGibberishImpl if ( subGroups.contains(gibberishGroup) ) return this; - Iterator subGroupsIter = subgroups(); + Iterator<ContactGroup> subGroupsIter = subgroups(); while (subGroupsIter.hasNext()) { ContactGroupGibberishImpl subgroup @@ -235,7 +235,7 @@ public class ContactGroupGibberishImpl if ( contacts.contains(gibberishContact) ) return this; - Iterator subGroupsIter = subgroups(); + Iterator<ContactGroup> subGroupsIter = subgroups(); while (subGroupsIter.hasNext()) { ContactGroupGibberishImpl subgroup @@ -255,16 +255,16 @@ public class ContactGroupGibberishImpl /** * Returns the <tt>Contact</tt> with the specified address or identifier. * - * @param id the addres or identifier of the <tt>Contact</tt> we are + * @param id the address or identifier of the <tt>Contact</tt> we are * looking for. * @return the <tt>Contact</tt> with the specified id or address. */ public Contact getContact(String id) { - Iterator contactsIter = contacts(); + Iterator<Contact> contactsIter = contacts(); while (contactsIter.hasNext()) { - ContactGibberishImpl contact = (ContactGibberishImpl) contactsIter.next(); + Contact contact = contactsIter.next(); if (contact.getAddress().equals(id)) return contact; @@ -280,7 +280,7 @@ public class ContactGroupGibberishImpl */ public ContactGroup getGroup(int index) { - return (ContactGroup)subGroups.get(index); + return subGroups.get(index); } /** @@ -291,11 +291,10 @@ public class ContactGroupGibberishImpl */ public ContactGroup getGroup(String groupName) { - Iterator groupsIter = subgroups(); + Iterator<ContactGroup> groupsIter = subgroups(); while (groupsIter.hasNext()) { - ContactGroupGibberishImpl contactGroup - = (ContactGroupGibberishImpl) groupsIter.next(); + ContactGroup contactGroup = groupsIter.next(); if (contactGroup.getGroupName().equals(groupName)) return contactGroup; @@ -330,7 +329,7 @@ public class ContactGroupGibberishImpl * @return a java.util.Iterator over the <tt>ContactGroup</tt> children * of this group (i.e. subgroups). */ - public Iterator subgroups() + public Iterator<ContactGroup> subgroups() { return subGroups.iterator(); } @@ -353,23 +352,24 @@ public class ContactGroupGibberishImpl public ContactGibberishImpl findContactByID(String id) { //first go through the contacts that are direct children. - Iterator contactsIter = contacts(); + Iterator<Contact> contactsIter = contacts(); while(contactsIter.hasNext()) { - ContactGibberishImpl mContact = (ContactGibberishImpl)contactsIter.next(); + ContactGibberishImpl mContact + = (ContactGibberishImpl) contactsIter.next(); if( mContact.getAddress().equals(id) ) return mContact; } //if we didn't find it here, let's try in the subougroups - Iterator groupsIter = subgroups(); + Iterator<ContactGroup> groupsIter = subgroups(); while( groupsIter.hasNext() ) { - ContactGroupGibberishImpl mGroup = (ContactGroupGibberishImpl)groupsIter.next(); - + ContactGroupGibberishImpl mGroup + = (ContactGroupGibberishImpl)groupsIter.next(); ContactGibberishImpl mContact = mGroup.findContactByID(id); if (mContact != null) @@ -391,10 +391,10 @@ public class ContactGroupGibberishImpl StringBuffer buff = new StringBuffer(getGroupName()); buff.append(".subGroups=" + countSubgroups() + ":\n"); - Iterator subGroups = subgroups(); + Iterator<ContactGroup> subGroups = subgroups(); while (subGroups.hasNext()) { - ContactGroupGibberishImpl group = (ContactGroupGibberishImpl)subGroups.next(); + ContactGroup group = subGroups.next(); buff.append(group.toString()); if (subGroups.hasNext()) buff.append("\n"); @@ -402,10 +402,10 @@ public class ContactGroupGibberishImpl buff.append("\nChildContacts="+countContacts()+":["); - Iterator contacts = contacts(); + Iterator<Contact> contacts = contacts(); while (contacts.hasNext()) { - ContactGibberishImpl contact = (ContactGibberishImpl) contacts.next(); + Contact contact = contacts.next(); buff.append(contact.toString()); if(contacts.hasNext()) buff.append(", "); @@ -537,15 +537,12 @@ public class ContactGroupGibberishImpl return false; //traverse child contacts - Iterator theirContacts = gibberishGroup.contacts(); + Iterator<Contact> theirContacts = gibberishGroup.contacts(); while(theirContacts.hasNext()) { - ContactGibberishImpl theirContact - = (ContactGibberishImpl)theirContacts.next(); - - ContactGibberishImpl ourContact - = (ContactGibberishImpl)getContact(theirContact.getAddress()); + Contact theirContact = theirContacts.next(); + Contact ourContact = getContact(theirContact.getAddress()); if(ourContact == null || !ourContact.equals(theirContact)) @@ -553,16 +550,12 @@ public class ContactGroupGibberishImpl } //traverse subgroups - Iterator theirSubgroups = gibberishGroup.subgroups(); + Iterator<ContactGroup> theirSubgroups = gibberishGroup.subgroups(); while(theirSubgroups.hasNext()) { - ContactGroupGibberishImpl theirSubgroup - = (ContactGroupGibberishImpl)theirSubgroups.next(); - - ContactGroupGibberishImpl ourSubgroup - = (ContactGroupGibberishImpl)getGroup( - theirSubgroup.getGroupName()); + ContactGroup theirSubgroup = theirSubgroups.next(); + ContactGroup ourSubgroup = getGroup(theirSubgroup.getGroupName()); if(ourSubgroup == null || !ourSubgroup.equals(theirSubgroup)) @@ -572,4 +565,3 @@ public class ContactGroupGibberishImpl return true; } } - diff --git a/src/net/java/sip/communicator/impl/protocol/gibberish/GibberishAccountID.java b/src/net/java/sip/communicator/impl/protocol/gibberish/GibberishAccountID.java index 8b7e1c6..e391b5f 100644 --- a/src/net/java/sip/communicator/impl/protocol/gibberish/GibberishAccountID.java +++ b/src/net/java/sip/communicator/impl/protocol/gibberish/GibberishAccountID.java @@ -22,7 +22,7 @@ public class GibberishAccountID * @param userID the user identifier correspnding to thi account * @param accountProperties any other properties necessary for the account. */ - GibberishAccountID(String userID, Map accountProperties) + GibberishAccountID(String userID, Map<String, String> accountProperties) { super(userID , accountProperties diff --git a/src/net/java/sip/communicator/impl/protocol/gibberish/GibberishActivator.java b/src/net/java/sip/communicator/impl/protocol/gibberish/GibberishActivator.java index 35504ea..6bc7e3d 100644 --- a/src/net/java/sip/communicator/impl/protocol/gibberish/GibberishActivator.java +++ b/src/net/java/sip/communicator/impl/protocol/gibberish/GibberishActivator.java @@ -60,7 +60,7 @@ public class GibberishActivator { GibberishActivator.bundleContext = context; - Hashtable hashtable = new Hashtable(); + Hashtable<String, String> hashtable = new Hashtable<String, String>(); hashtable.put(ProtocolProviderFactory.PROTOCOL, "Gibberish"); gibberishProviderFactory = new ProtocolProviderFactoryGibberishImpl(); diff --git a/src/net/java/sip/communicator/impl/protocol/gibberish/OperationSetPersistentPresenceGibberishImpl.java b/src/net/java/sip/communicator/impl/protocol/gibberish/OperationSetPersistentPresenceGibberishImpl.java index 06f13dc..2f9a2bb 100644 --- a/src/net/java/sip/communicator/impl/protocol/gibberish/OperationSetPersistentPresenceGibberishImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/gibberish/OperationSetPersistentPresenceGibberishImpl.java @@ -286,13 +286,12 @@ public class OperationSetPersistentPresenceGibberishImpl //now check whether we are in someone else's contact list and modify //our status there - List contacts = findContactsPointingToUs(); + List<Contact> contacts = findContactsPointingToUs(); - Iterator contactsIter = contacts.iterator(); + Iterator<Contact> contactsIter = contacts.iterator(); while (contactsIter.hasNext()) { - ContactGibberishImpl contact - = (ContactGibberishImpl) contactsIter.next(); + ContactGibberishImpl contact = (ContactGibberishImpl)contactsIter.next(); PresenceStatus oldStatus = contact.getPresenceStatus(); contact.setPresenceStatus(status); @@ -360,7 +359,7 @@ public class OperationSetPersistentPresenceGibberishImpl PresenceStatus newStatus) { //first set the status for contacts in this group - Iterator childContacts = parent.contacts(); + Iterator<Contact> childContacts = parent.contacts(); while(childContacts.hasNext()) { @@ -381,11 +380,11 @@ public class OperationSetPersistentPresenceGibberishImpl } //now call this method recursively for all subgroups - Iterator subgroups = parent.subgroups(); + Iterator<ContactGroup> subgroups = parent.subgroups(); while(subgroups.hasNext()) { - ContactGroup subgroup = (ContactGroup)subgroups.next(); + ContactGroup subgroup = subgroups.next(); changePresenceStatusForAllContacts(subgroup, newStatus); } } @@ -798,9 +797,9 @@ public class OperationSetPersistentPresenceGibberishImpl * @return a list of all contacts in other providers' contact lists that * point to us. */ - public List findContactsPointingToUs() + public List<Contact> findContactsPointingToUs() { - List contacts = new LinkedList(); + List<Contact> contacts = new LinkedList<Contact>(); BundleContext bc = GibberishActivator.getBundleContext(); String osgiQuery = @@ -906,20 +905,17 @@ public class OperationSetPersistentPresenceGibberishImpl //offline. The icq protocol does not implement top level buddies //nor subgroups for top level groups so a simple nested loop //would be enough. - Iterator groupsIter = getServerStoredContactListRoot() - .subgroups(); + Iterator<ContactGroup> groupsIter + = getServerStoredContactListRoot().subgroups(); while (groupsIter.hasNext()) { - ContactGroupGibberishImpl group - = (ContactGroupGibberishImpl) groupsIter.next(); - - Iterator contactsIter = group.contacts(); + ContactGroup group = groupsIter.next(); + Iterator<Contact> contactsIter = group.contacts(); while (contactsIter.hasNext()) { ContactGibberishImpl contact = (ContactGibberishImpl) contactsIter.next(); - PresenceStatus oldContactStatus = contact.getPresenceStatus(); diff --git a/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderFactoryGibberishImpl.java b/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderFactoryGibberishImpl.java index c6faa41..3d0980f 100644 --- a/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderFactoryGibberishImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderFactoryGibberishImpl.java @@ -41,7 +41,7 @@ public class ProtocolProviderFactoryGibberishImpl * @return the AccountID of the newly created account. */ public AccountID installAccount( String userIDStr, - Map accountProperties) + Map<String, String> accountProperties) { BundleContext context = GibberishActivator.getBundleContext(); @@ -88,7 +88,7 @@ public class ProtocolProviderFactoryGibberishImpl * @throws java.lang.NullPointerException if any of the arguments is null. */ public void modifyAccount( ProtocolProviderService protocolProvider, - Map accountProperties) + Map<String, String> accountProperties) { // Make sure the specified arguments are valid. if (protocolProvider == null) @@ -113,8 +113,7 @@ public class ProtocolProviderFactoryGibberishImpl if(!registeredAccounts.containsKey(accountID)) return; - ServiceRegistration registration - = (ServiceRegistration) registeredAccounts.get(accountID); + ServiceRegistration registration = registeredAccounts.get(accountID); // kill the service if (registration != null) @@ -133,7 +132,7 @@ public class ProtocolProviderFactoryGibberishImpl // and check for a password. this.storeAccount(accountID); - Hashtable properties = new Hashtable(); + Hashtable<String, String> properties = new Hashtable<String, String>(); properties.put(PROTOCOL, ProtocolNames.GIBBERISH); properties.put(USER_ID, accountID.getUserID()); @@ -154,7 +153,7 @@ public class ProtocolProviderFactoryGibberishImpl registeredAccounts.put(accountID, registration); } - protected AccountID createAccountID(String userID, Map accountProperties) + protected AccountID createAccountID(String userID, Map<String, String> accountProperties) { return new GibberishAccountID(userID, accountProperties); } diff --git a/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderServiceGibberishImpl.java b/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderServiceGibberishImpl.java index 6a64b1a..9ce7be7 100644 --- a/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderServiceGibberishImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderServiceGibberishImpl.java @@ -101,9 +101,7 @@ public class ProtocolProviderServiceGibberishImpl //initialize the IM operation set OperationSetBasicInstantMessagingGibberishImpl basicInstantMessaging = new OperationSetBasicInstantMessagingGibberishImpl( - this - , (OperationSetPersistentPresenceGibberishImpl) - persistentPresence); + this, persistentPresence); supportedOperationSets.put( OperationSetBasicInstantMessaging.class.getName(), diff --git a/src/net/java/sip/communicator/impl/protocol/icq/ContactGroupIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/ContactGroupIcqImpl.java index 3c9a522..5ddb8c6 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/ContactGroupIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/ContactGroupIcqImpl.java @@ -474,19 +474,19 @@ public class ContactGroupIcqImpl * @param removedContacts contacts assumed deleted because they were in the * local group but were not in the serverBuddies list. */ - void updateGroup(MutableGroup joustSimGroup, - List serverBuddies, - List newContacts, - List removedContacts) + void updateGroup(MutableGroup joustSimGroup, + List<Buddy> serverBuddies, + List<Contact> newContacts, + List<ContactIcqImpl> removedContacts) { setResolved(true); this.joustSimSourceGroup = joustSimGroup; - Iterator serverBuddiesIter = serverBuddies.iterator(); + Iterator<Buddy> serverBuddiesIter = serverBuddies.iterator(); while(serverBuddiesIter.hasNext()) { - Buddy buddy = (Buddy)serverBuddiesIter.next(); + Buddy buddy = serverBuddiesIter.next(); if(buddy.isAwaitingAuthorization()) { diff --git a/src/net/java/sip/communicator/impl/protocol/icq/IcqAccountID.java b/src/net/java/sip/communicator/impl/protocol/icq/IcqAccountID.java index df7f6a6..37b7172 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/IcqAccountID.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/IcqAccountID.java @@ -24,7 +24,7 @@ public class IcqAccountID * @param uin the uin identifying this account * @param accountProperties any other properties necessary for the account. */ - IcqAccountID(String uin, Map accountProperties ) + IcqAccountID(String uin, Map<String, String> accountProperties ) { super(uin, accountProperties, isAIM(accountProperties) ? ProtocolNames.AIM : ProtocolNames.ICQ, diff --git a/src/net/java/sip/communicator/impl/protocol/icq/IcqActivator.java b/src/net/java/sip/communicator/impl/protocol/icq/IcqActivator.java index b483508..2406f3e 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/IcqActivator.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/IcqActivator.java @@ -41,10 +41,10 @@ public class IcqActivator { IcqActivator.bundleContext = context; - Hashtable icqHashtable = new Hashtable(); + Hashtable<String, String> icqHashtable = new Hashtable<String, String>(); icqHashtable.put(ProtocolProviderFactory.PROTOCOL, ProtocolNames.ICQ); - Hashtable aimHashtable = new Hashtable(); + Hashtable<String, String> aimHashtable = new Hashtable<String, String>(); aimHashtable.put(ProtocolProviderFactory.PROTOCOL, ProtocolNames.AIM); icqProviderFactory = new ProtocolProviderFactoryIcqImpl(false); diff --git a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java index 6a7f0ec..d7e7306 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java @@ -104,7 +104,8 @@ public class OperationSetBasicInstantMessagingIcqImpl /** * The queue holding the received packets */ - private LinkedList receivedKeepAlivePackets = new LinkedList(); + private final LinkedList<String> receivedKeepAlivePackets + = new LinkedList<String>(); /** * The ping message prefix that we use in our keep alive thread. @@ -674,8 +675,7 @@ public class OperationSetBasicInstantMessagingIcqImpl boolean checkFirstPacket() throws Exception { - String receivedStr = - (String)receivedKeepAlivePackets.removeLast(); + String receivedStr = receivedKeepAlivePackets.removeLast(); logger.trace("Last keep alive message is: " + receivedStr); diff --git a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetMultiUserChatIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetMultiUserChatIcqImpl.java index eba40c9..8a61eff 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetMultiUserChatIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetMultiUserChatIcqImpl.java @@ -36,13 +36,14 @@ public class OperationSetMultiUserChatIcqImpl * we have not necessarily joined these rooms, we might have simply been * searching through them. */ - private Hashtable chatRoomCache = new Hashtable(); + private final Map<String, ChatRoom> chatRoomCache + = new Hashtable<String, ChatRoom>(); /** * The registration listener that would get notified when the underlying * ICQ provider gets registered. */ - private RegistrationStateListener providerRegListener + private final RegistrationStateListener providerRegListener = new RegistrationStateListener(); /** @@ -55,7 +56,8 @@ public class OperationSetMultiUserChatIcqImpl * Hash table that contains all invitations, this is needed if the user wants * to reject an invitation. */ - private Hashtable invitations = new Hashtable(); + private final Map<ChatRoom, ChatInvitation> invitations + = new Hashtable<ChatRoom, ChatInvitation>(); /** * Default Invitation message. @@ -96,7 +98,7 @@ public class OperationSetMultiUserChatIcqImpl public ChatRoom findRoom(ChatInvitation chatInvitation) throws OperationFailedException, OperationNotSupportedException { - ChatRoom chatRoom = (ChatRoom) chatRoomCache.get(chatInvitation + ChatRoom chatRoom = chatRoomCache.get(chatInvitation .getRoomName()); if (chatRoom == null) @@ -186,7 +188,7 @@ public class OperationSetMultiUserChatIcqImpl public ChatRoom findRoom(String roomName) throws OperationFailedException, OperationNotSupportedException { - ChatRoom room = (ChatRoom) chatRoomCache.get(roomName); + ChatRoom room = chatRoomCache.get(roomName); return room; } @@ -198,17 +200,17 @@ public class OperationSetMultiUserChatIcqImpl * @return a <tt>List</tt> of the rooms where the user has joined using * a given connection. */ - public List getCurrentlyJoinedChatRooms() + public List<ChatRoom> getCurrentlyJoinedChatRooms() { synchronized (chatRoomCache) { - List joinedRooms = new LinkedList(this.chatRoomCache.values()); + List<ChatRoom> joinedRooms = new LinkedList<ChatRoom>(this.chatRoomCache.values()); - Iterator joinedRoomsIter = joinedRooms.iterator(); + Iterator<ChatRoom> joinedRoomsIter = joinedRooms.iterator(); while (joinedRoomsIter.hasNext()) { - if (!((ChatRoom) joinedRoomsIter.next()).isJoined()) + if (!joinedRoomsIter.next().isJoined()) joinedRoomsIter.remove(); } @@ -230,21 +232,20 @@ public class OperationSetMultiUserChatIcqImpl * @throws OperationNotSupportedException if the server does not support * multi user chat */ - public List getCurrentlyJoinedChatRooms(ChatRoomMember chatRoomMember) - throws OperationFailedException, OperationNotSupportedException + public List<String> getCurrentlyJoinedChatRooms( + ChatRoomMember chatRoomMember) + throws OperationFailedException, + OperationNotSupportedException { synchronized (chatRoomCache) { - List joinedRooms = new LinkedList(this.chatRoomCache.values()); - - Iterator joinedRoomsIter = joinedRooms.iterator(); - - while (joinedRoomsIter.hasNext()) - { - if (!((ChatRoom) joinedRoomsIter.next()).isJoined()) - joinedRoomsIter.remove(); - } + List<String> joinedRooms + = new LinkedList<String>(); + for (Map.Entry<String, ChatRoom> chatRoomEntry + : chatRoomCache.entrySet()) + if (chatRoomEntry.getValue().isJoined()) + joinedRooms.add(chatRoomEntry.getKey()); return joinedRooms; } } @@ -264,10 +265,10 @@ public class OperationSetMultiUserChatIcqImpl * @throws OperationNotSupportedException if the server does not support * multi user chat */ - public List getExistingChatRooms() throws OperationFailedException, + public List<String> getExistingChatRooms() throws OperationFailedException, OperationNotSupportedException { - return new LinkedList(); + return new LinkedList<String>(); } /** @@ -296,7 +297,7 @@ public class OperationSetMultiUserChatIcqImpl public void rejectInvitation(ChatRoomInvitation invitation, String rejectReason) { - ChatInvitation inv = (ChatInvitation) invitations.get(invitation + ChatInvitation inv = invitations.get(invitation .getTargetChatRoom()); if (inv != null) @@ -458,14 +459,11 @@ public class OperationSetMultiUserChatIcqImpl */ private void updateChatRoomMembers(Contact contact) { - Enumeration<ChatRoomIcqImpl> chatRooms = chatRoomCache.elements(); - - while (chatRooms.hasMoreElements()) + for (ChatRoom chatRoom : chatRoomCache.values()) { - ChatRoomIcqImpl chatRoom = chatRooms.nextElement(); - ChatRoomMemberIcqImpl member - = chatRoom.findMemberForNickName(contact.getAddress()); + = ((ChatRoomIcqImpl) chatRoom) + .findMemberForNickName(contact.getAddress()); if (member != null) { diff --git a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java index 35d21de..c9f710e 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java @@ -1450,9 +1450,9 @@ public class OperationSetPersistentPresenceIcqImpl ContactGroupIcqImpl parent = ssContactList.findContactGroup(parentGroup); srcContact = ssContactList. - createUnresolvedContact((ContactGroupIcqImpl)parent, screenname); + createUnresolvedContact(parent, screenname); - Buddy buddy = ((ContactIcqImpl)srcContact).getJoustSimBuddy(); + Buddy buddy = srcContact.getJoustSimBuddy(); if(buddy instanceof VolatileBuddy) ((VolatileBuddy)buddy).setAwaitingAuthorization(true); @@ -1481,7 +1481,7 @@ public class OperationSetPersistentPresenceIcqImpl } - ((ContactGroupIcqImpl)parent).removeContact(srcContact); + parent.removeContact(srcContact); theAwaitingAuthorizationGroup.addContact(srcContact); try diff --git a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetServerStoredAccountInfoIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetServerStoredAccountInfoIcqImpl.java index c97a97f..efa635a 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetServerStoredAccountInfoIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetServerStoredAccountInfoIcqImpl.java @@ -316,7 +316,7 @@ public class OperationSetServerStoredAccountInfoIcqImpl Iterator i = getDetails(SpokenLanguageDetail.class); while (i.hasNext()) { - Object item = (Object) i.next(); + Object item = i.next(); langs[count++] = getLanguageCode(((SpokenLanguageDetail)item).getLocale()); } langs[count] = getLanguageCode(((SpokenLanguageDetail)detail).getLocale()); @@ -642,7 +642,7 @@ public class OperationSetServerStoredAccountInfoIcqImpl Iterator i = getDetails(SpokenLanguageDetail.class); while (i.hasNext()) { - Object item = (Object) i.next(); + Object item = i.next(); if(item.equals(currentDetailValue)) langs[count++] = getLanguageCode(((SpokenLanguageDetail)newDetailValue).getLocale()); else diff --git a/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderFactoryIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderFactoryIcqImpl.java index 75c05fb..3d10637 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderFactoryIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderFactoryIcqImpl.java @@ -50,7 +50,7 @@ public class ProtocolProviderFactoryIcqImpl * @return the AccountID of the newly created account */ public AccountID installAccount( String userIDStr, - Map accountProperties) + Map<String, String> accountProperties) { BundleContext context = IcqActivator.getBundleContext(); if (context == null) @@ -94,7 +94,7 @@ public class ProtocolProviderFactoryIcqImpl * properties defining the new account. * @return the AccountID of the newly created account */ - public AccountID loadAccount(Map accountProperties) + public AccountID loadAccount(Map<String, String> accountProperties) { // there are two factories - one for icq accounts and one for aim ones. // if we are trying to load an icq account in aim factory - skip it @@ -109,7 +109,7 @@ public class ProtocolProviderFactoryIcqImpl return super.loadAccount(accountProperties); } - protected AccountID createAccountID(String userID, Map accountProperties) + protected AccountID createAccountID(String userID, Map<String, String> accountProperties) { return new IcqAccountID(userID, accountProperties); } @@ -126,7 +126,7 @@ public class ProtocolProviderFactoryIcqImpl @Override public void modifyAccount( ProtocolProviderService protocolProvider, - Map accountProperties) + Map<String, String> accountProperties) throws NullPointerException { // Make sure the specified arguments are valid. @@ -151,8 +151,7 @@ public class ProtocolProviderFactoryIcqImpl if(!registeredAccounts.containsKey(accountID)) return; - ServiceRegistration registration - = (ServiceRegistration) registeredAccounts.get(accountID); + ServiceRegistration registration = registeredAccounts.get(accountID); // kill the service if (registration != null) @@ -171,7 +170,7 @@ public class ProtocolProviderFactoryIcqImpl // and check for a password. this.storeAccount(accountID); - Hashtable properties = new Hashtable(); + Hashtable<String, String> properties = new Hashtable<String, String>(); properties.put(PROTOCOL, ProtocolNames.ICQ); properties.put(USER_ID, accountID.getUserID()); diff --git a/src/net/java/sip/communicator/impl/protocol/icq/ServerStoredContactListIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/ServerStoredContactListIcqImpl.java index 5f41f9f..769dd14 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/ServerStoredContactListIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/ServerStoredContactListIcqImpl.java @@ -99,12 +99,6 @@ public class ServerStoredContactListIcqImpl = new String("Awaiting authorization"); /** - * A map containing all contacts currently - */ - private Map<String, String> contactParentsMap - = new Hashtable<String, String>(); - - /** * Creates a ServerStoredContactList wrapper for the specified BuddyList. * * @param parentOperationSet the operation set that created us and that @@ -199,18 +193,16 @@ public class ServerStoredContactListIcqImpl logger.trace("Will dispatch the following grp event: " + evt); - Iterator<ServerStoredGroupListener> listeners = null; + Iterable<ServerStoredGroupListener> listeners; synchronized (serverStoredGroupListeners) { - listeners = new ArrayList<ServerStoredGroupListener>( - serverStoredGroupListeners).iterator(); + listeners + = new ArrayList<ServerStoredGroupListener>( + serverStoredGroupListeners); } - while (listeners.hasNext()) + for (ServerStoredGroupListener listener : listeners) { - ServerStoredGroupListener listener - = (ServerStoredGroupListener) listeners.next(); - if (eventID == ServerStoredGroupEvent.GROUP_REMOVED_EVENT) listener.groupRemoved(evt); else if (eventID == ServerStoredGroupEvent.GROUP_RENAMED_EVENT) @@ -235,8 +227,8 @@ public class ServerStoredContactListIcqImpl * @param contact the contact that was added * @param index the index at which it was added. */ - private void fireContactAdded( ContactGroupIcqImpl parentGroup, - ContactIcqImpl contact) + private void fireContactAdded( ContactGroup parentGroup, + Contact contact) { //bail out if no one's listening if(parentOperationSet == null){ @@ -255,8 +247,8 @@ public class ServerStoredContactListIcqImpl * @param parentGroup the group that the resolved contact belongs to. * @param contact the contact that was resolved */ - private void fireContactResolved( ContactGroupIcqImpl parentGroup, - ContactIcqImpl contact) + private void fireContactResolved( ContactGroup parentGroup, + Contact contact) { //bail out if no one's listening if(parentOperationSet == null){ @@ -279,9 +271,9 @@ public class ServerStoredContactListIcqImpl * @param contact the contact that was added * @param index the index at which it was added. */ - private void fireContactMoved( ContactGroupIcqImpl oldParentGroup, - ContactGroupIcqImpl newParentGroup, - ContactIcqImpl contact, + private void fireContactMoved( ContactGroup oldParentGroup, + ContactGroup newParentGroup, + Contact contact, int index) { //bail out if no one's listening @@ -302,8 +294,8 @@ public class ServerStoredContactListIcqImpl * @param parentGroup the group where that the removed contact belonged to. * @param contact the contact that was removed. */ - private void fireContactRemoved( ContactGroupIcqImpl parentGroup, - ContactIcqImpl contact) + private void fireContactRemoved( ContactGroup parentGroup, + Contact contact) { //bail out if no one's listening if(parentOperationSet == null){ @@ -856,11 +848,8 @@ public class ServerStoredContactListIcqImpl if(!elem.isPersistent() || !elem.isResolved()) continue; - Iterator bs = elem.getJoustSimSourceGroup().getBuddiesCopy() - .iterator(); - while (bs.hasNext()) + for (Buddy b : elem.getJoustSimSourceGroup().getBuddiesCopy()) { - Buddy b = (Buddy) bs.next(); if(b == buddy) return elem; } @@ -927,8 +916,7 @@ public class ServerStoredContactListIcqImpl = deletedContacts.iterator(); while(deletedContactsIter.hasNext()) { - ContactIcqImpl contact - = (ContactIcqImpl)deletedContactsIter.next(); + ContactIcqImpl contact = deletedContactsIter.next(); fireContactRemoved(newGroup, contact); } @@ -936,8 +924,7 @@ public class ServerStoredContactListIcqImpl Iterator<Contact> contactsIter = newGroup.contacts(); while(contactsIter.hasNext()) { - ContactIcqImpl contact - = (ContactIcqImpl)contactsIter.next(); + Contact contact = contactsIter.next(); if(newContacts.contains(contact)) fireContactAdded(newGroup, contact); @@ -1384,7 +1371,7 @@ public class ServerStoredContactListIcqImpl = copyContactsForUpdate.iterator(); while (iter.hasNext()) { - ContactIcqImpl contact = (ContactIcqImpl) iter.next(); + ContactIcqImpl contact = iter.next(); String oldNickname = contact.getUIN(); diff --git a/src/net/java/sip/communicator/impl/protocol/irc/ChatRoomIrcImpl.java b/src/net/java/sip/communicator/impl/protocol/irc/ChatRoomIrcImpl.java index 92400ef..4a4567c 100644 --- a/src/net/java/sip/communicator/impl/protocol/irc/ChatRoomIrcImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/irc/ChatRoomIrcImpl.java @@ -612,7 +612,7 @@ public class ChatRoomIrcImpl */ protected ChatRoomMember getChatRoomMember(String memberID) { - return (ChatRoomMember) chatRoomMembers.get(memberID); + return chatRoomMembers.get(memberID); } /** @@ -806,20 +806,15 @@ public class ChatRoomIrcImpl msg, eventType); - Iterator<ChatRoomMessageListener> listeners = null; + Iterable<ChatRoomMessageListener> listeners; synchronized (messageListeners) { - listeners = new ArrayList<ChatRoomMessageListener>(messageListeners) - .iterator(); + listeners + = new ArrayList<ChatRoomMessageListener>(messageListeners); } - while (listeners.hasNext()) - { - ChatRoomMessageListener listener - = (ChatRoomMessageListener) listeners.next(); - + for (ChatRoomMessageListener listener : listeners) listener.messageDelivered(msgDeliveredEvt); - } } /** @@ -846,20 +841,15 @@ public class ChatRoomIrcImpl message, eventType); - Iterator<ChatRoomMessageListener> listeners = null; + Iterable<ChatRoomMessageListener> listeners; synchronized (messageListeners) { - listeners = new ArrayList<ChatRoomMessageListener>( - messageListeners).iterator(); + listeners + = new ArrayList<ChatRoomMessageListener>(messageListeners); } - while (listeners.hasNext()) - { - ChatRoomMessageListener listener - = (ChatRoomMessageListener) listeners.next(); - + for (ChatRoomMessageListener listener : listeners) listener.messageReceived(event); - } } /** @@ -870,18 +860,16 @@ public class ChatRoomIrcImpl */ public void firePropertyChangeEvent(PropertyChangeEvent evt) { - Iterator<ChatRoomPropertyChangeListener> listeners = null; + Iterable<ChatRoomPropertyChangeListener> listeners; synchronized (propertyChangeListeners) { - listeners = new ArrayList<ChatRoomPropertyChangeListener>( - propertyChangeListeners).iterator(); + listeners + = new ArrayList<ChatRoomPropertyChangeListener>( + propertyChangeListeners); } - while (listeners.hasNext()) + for (ChatRoomPropertyChangeListener listener : listeners) { - ChatRoomPropertyChangeListener listener - = (ChatRoomPropertyChangeListener) listeners.next(); - if (evt instanceof ChatRoomPropertyChangeEvent) { listener.chatRoomPropertyChanged( @@ -904,20 +892,16 @@ public class ChatRoomIrcImpl public void fireMemberPropertyChangeEvent( ChatRoomMemberPropertyChangeEvent evt) { - Iterator<ChatRoomMemberPropertyChangeListener> listeners = null; + Iterable<ChatRoomMemberPropertyChangeListener> listeners; synchronized (memberPropChangeListeners) { - listeners = new ArrayList<ChatRoomMemberPropertyChangeListener>( - memberPropChangeListeners).iterator(); + listeners + = new ArrayList<ChatRoomMemberPropertyChangeListener>( + memberPropChangeListeners); } - while (listeners.hasNext()) - { - ChatRoomMemberPropertyChangeListener listener - = (ChatRoomMemberPropertyChangeListener) listeners.next(); - + for (ChatRoomMemberPropertyChangeListener listener : listeners) listener.chatRoomPropertyChanged(evt); - } } /** @@ -946,11 +930,12 @@ public class ChatRoomIrcImpl logger.trace("Will dispatch the following ChatRoom event: " + evt); - List<ChatRoomMemberPresenceListener> listeners; + Iterable<ChatRoomMemberPresenceListener> listeners; synchronized (memberListeners) { - listeners = new ArrayList<ChatRoomMemberPresenceListener>( - memberListeners); + listeners + = new ArrayList<ChatRoomMemberPresenceListener>( + memberListeners); } for (ChatRoomMemberPresenceListener listener : listeners) listener.memberPresenceChanged(evt); @@ -977,20 +962,16 @@ public class ChatRoomIrcImpl logger.trace("Will dispatch the following ChatRoom event: " + evt); - Iterator<ChatRoomMemberRoleListener> listeners = null; + Iterable<ChatRoomMemberRoleListener> listeners; synchronized (memberRoleListeners) { - listeners = new ArrayList<ChatRoomMemberRoleListener>( - memberRoleListeners).iterator(); + listeners + = new ArrayList<ChatRoomMemberRoleListener>( + memberRoleListeners); } - while (listeners.hasNext()) - { - ChatRoomMemberRoleListener listener - = (ChatRoomMemberRoleListener) listeners.next(); - + for (ChatRoomMemberRoleListener listener : listeners) listener.memberRoleChanged(evt); - } } /** @@ -1067,4 +1048,4 @@ public class ChatRoomIrcImpl */ return !isPrivate(); } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/impl/protocol/irc/IrcAccountID.java b/src/net/java/sip/communicator/impl/protocol/irc/IrcAccountID.java index a8f5d26..ad27eee 100644 --- a/src/net/java/sip/communicator/impl/protocol/irc/IrcAccountID.java +++ b/src/net/java/sip/communicator/impl/protocol/irc/IrcAccountID.java @@ -25,7 +25,7 @@ public class IrcAccountID * @param userID the user identifier corresponding to this account * @param accountProperties any other properties necessary for the account. */ - IrcAccountID(String userID, Map accountProperties) + IrcAccountID(String userID, Map<String, String> accountProperties) { super( userID, accountProperties, @@ -53,4 +53,4 @@ public class IrcAccountID else return ProtocolNames.IRC; } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/impl/protocol/irc/IrcActivator.java b/src/net/java/sip/communicator/impl/protocol/irc/IrcActivator.java index 0a8a91c..8df148c 100644 --- a/src/net/java/sip/communicator/impl/protocol/irc/IrcActivator.java +++ b/src/net/java/sip/communicator/impl/protocol/irc/IrcActivator.java @@ -55,7 +55,7 @@ public class IrcActivator { bundleContext = context; - Hashtable hashtable = new Hashtable(); + Hashtable<String, String> hashtable = new Hashtable<String, String>(); hashtable.put(ProtocolProviderFactory.PROTOCOL, ProtocolNames.IRC); ircProviderFactory = new ProtocolProviderFactoryIrcImpl(); @@ -117,4 +117,4 @@ public class IrcActivator return resourceService; } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/impl/protocol/irc/IrcStack.java b/src/net/java/sip/communicator/impl/protocol/irc/IrcStack.java index c995976..8dac9cc 100644 --- a/src/net/java/sip/communicator/impl/protocol/irc/IrcStack.java +++ b/src/net/java/sip/communicator/impl/protocol/irc/IrcStack.java @@ -222,7 +222,7 @@ public class IrcStack ChatRoomIrcImpl chatRoom = ircMUCOpSet.getChatRoom(channel); if (chatRoom == null) - chatRoom = (ChatRoomIrcImpl) ircMUCOpSet.findSystemRoom(); + chatRoom = ircMUCOpSet.findSystemRoom(); if(chatRoom == null || !chatRoom.isJoined()) return; @@ -322,7 +322,7 @@ public class IrcStack ChatRoomIrcImpl chatRoom = ircMUCOpSet.getChatRoom(target); if (chatRoom == null) - chatRoom = (ChatRoomIrcImpl) ircMUCOpSet.findSystemRoom(); + chatRoom = ircMUCOpSet.findSystemRoom(); if(chatRoom == null || !chatRoom.isJoined()) return; @@ -527,8 +527,7 @@ public class IrcStack + ": Received from " + kickerNick + " " + kickerLogin + "@" + kickerHostname); - ChatRoomIrcImpl chatRoom - = (ChatRoomIrcImpl) ircMUCOpSet.getChatRoom(channel); + ChatRoomIrcImpl chatRoom = ircMUCOpSet.getChatRoom(channel); if (chatRoom == null || !chatRoom.isJoined()) return; @@ -643,7 +642,7 @@ public class IrcStack if(chatRoom == null || !chatRoom.isJoined()) { - chatRoom = (ChatRoomIrcImpl) ircMUCOpSet.findSystemRoom(); + chatRoom = ircMUCOpSet.findSystemRoom(); sourceMember = ircMUCOpSet.findSystemMember(); } @@ -1237,8 +1236,7 @@ public class IrcStack MessageIrcImpl.DEFAULT_MIME_ENCODING, null); - ChatRoomIrcImpl serverRoom - = (ChatRoomIrcImpl) ircMUCOpSet.findSystemRoom(); + ChatRoomIrcImpl serverRoom = ircMUCOpSet.findSystemRoom(); ChatRoomMember serverMember = ircMUCOpSet.findSystemMember(); @@ -1817,8 +1815,7 @@ public class IrcStack MessageIrcImpl.DEFAULT_MIME_ENCODING, null); - ChatRoomIrcImpl chatRoom - = (ChatRoomIrcImpl) ircMUCOpSet.findSystemRoom(); + ChatRoomIrcImpl chatRoom = ircMUCOpSet.findSystemRoom(); if(chatRoom == null || !chatRoom.isJoined()) return; diff --git a/src/net/java/sip/communicator/impl/protocol/irc/OperationSetMultiUserChatIrcImpl.java b/src/net/java/sip/communicator/impl/protocol/irc/OperationSetMultiUserChatIrcImpl.java index aae40c1..490861f 100644 --- a/src/net/java/sip/communicator/impl/protocol/irc/OperationSetMultiUserChatIrcImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/irc/OperationSetMultiUserChatIrcImpl.java @@ -328,4 +328,4 @@ public class OperationSetMultiUserChatIrcImpl "", // We don't specify a hostname. ChatRoomMemberRole.GUEST); } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderFactoryIrcImpl.java b/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderFactoryIrcImpl.java index 92858ab..109a2d2 100644 --- a/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderFactoryIrcImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderFactoryIrcImpl.java @@ -39,7 +39,7 @@ public class ProtocolProviderFactoryIrcImpl * @return the AccountID of the newly created account. */ public AccountID installAccount( String userIDStr, - Map accountProperties) + Map<String, String> accountProperties) { BundleContext context = IrcActivator.bundleContext; @@ -75,7 +75,7 @@ public class ProtocolProviderFactoryIrcImpl return accountID; } - protected AccountID createAccountID(String userID, Map accountProperties) + protected AccountID createAccountID(String userID, Map<String, String> accountProperties) { return new IrcAccountID(userID, accountProperties); } @@ -92,10 +92,10 @@ public class ProtocolProviderFactoryIrcImpl @Override public void modifyAccount( ProtocolProviderService protocolProvider, - Map accountProperties) + Map<String, String> accountProperties) throws NullPointerException { // TODO Auto-generated method stub } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/impl/protocol/irc/UserInfo.java b/src/net/java/sip/communicator/impl/protocol/irc/UserInfo.java index 69cbf91..f8bdafb 100644 --- a/src/net/java/sip/communicator/impl/protocol/irc/UserInfo.java +++ b/src/net/java/sip/communicator/impl/protocol/irc/UserInfo.java @@ -35,7 +35,7 @@ public class UserInfo /** * A list of the chat rooms this user is in. */ - private List joinedChatRoom = new LinkedList(); + private List<String> joinedChatRoom = new LinkedList<String>(); /** * Information about the server. @@ -127,7 +127,7 @@ public class UserInfo * * @return a list of the joined chat rooms of this user */ - public List getJoinedChatRooms() + public List<String> getJoinedChatRooms() { return joinedChatRoom; } @@ -212,4 +212,4 @@ public class UserInfo { this.serverInfo = serverInfo; } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ActiveCallsRepository.java b/src/net/java/sip/communicator/impl/protocol/jabber/ActiveCallsRepository.java index 346a073..49fbdb9 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ActiveCallsRepository.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ActiveCallsRepository.java @@ -73,7 +73,7 @@ public class ActiveCallsRepository if(evt.getEventType().equals(CallChangeEvent.CALL_STATE_CHANGE) && ((CallState)evt.getNewValue()).equals(CallState.CALL_ENDED)) { - CallJabberImpl sourceCall = (CallJabberImpl)this.activeCalls + CallJabberImpl sourceCall = this.activeCalls .remove(evt.getSourceCall().getCallID()); logger.trace( "Removing call " + sourceCall + " from the list of " diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java index 28cdae9..0f2ea31 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java @@ -98,12 +98,12 @@ public class ChatRoomJabberImpl /** * The list of members of this chat room. */ - private final Hashtable<String, ChatRoomMember> members = new Hashtable(); + private final Hashtable<String, ChatRoomMember> members = new Hashtable<String, ChatRoomMember>(); /** * The list of banned members of this chat room. */ - private final Hashtable<String, ChatRoomMember> banList = new Hashtable(); + private final Hashtable<String, ChatRoomMember> banList = new Hashtable<String, ChatRoomMember>(); /** * The nickname of this chat room local user participant. @@ -715,10 +715,9 @@ public class ChatRoomJabberImpl while(membersSet.hasNext()) { - Map.Entry<String, ChatRoomMember> memberEntry - = (Map.Entry<String, ChatRoomMember>) membersSet.next(); + Map.Entry<String, ChatRoomMember> memberEntry = membersSet.next(); - ChatRoomMember member = (ChatRoomMember) memberEntry.getValue(); + ChatRoomMember member = memberEntry.getValue(); fireMemberPresenceEvent(member, ChatRoomMemberPresenceChangeEvent.MEMBER_LEFT, @@ -1383,8 +1382,7 @@ public class ChatRoomJabberImpl while (listeners.hasNext()) { - ChatRoomMemberPresenceListener listener - = (ChatRoomMemberPresenceListener) listeners.next(); + ChatRoomMemberPresenceListener listener = listeners.next(); listener.memberPresenceChanged(evt); } @@ -1411,20 +1409,16 @@ public class ChatRoomJabberImpl logger.trace("Will dispatch the following ChatRoom event: " + evt); - Iterator<ChatRoomMemberPresenceListener> listeners = null; + Iterable<ChatRoomMemberPresenceListener> listeners; synchronized (memberListeners) { - listeners = new ArrayList<ChatRoomMemberPresenceListener>( - memberListeners).iterator(); + listeners + = new ArrayList<ChatRoomMemberPresenceListener>( + memberListeners); } - while (listeners.hasNext()) - { - ChatRoomMemberPresenceListener listener - = (ChatRoomMemberPresenceListener) listeners.next(); - + for (ChatRoomMemberPresenceListener listener : listeners) listener.memberPresenceChanged(evt); - } } /** @@ -1445,41 +1439,34 @@ public class ChatRoomJabberImpl logger.trace("Will dispatch the following ChatRoom event: " + evt); - Iterator<ChatRoomMemberRoleListener> listeners = null; + Iterable<ChatRoomMemberRoleListener> listeners; synchronized (memberRoleListeners) { - listeners = new ArrayList<ChatRoomMemberRoleListener>( - memberRoleListeners).iterator(); + listeners + = new ArrayList<ChatRoomMemberRoleListener>( + memberRoleListeners); } - while (listeners.hasNext()) - { - ChatRoomMemberRoleListener listener - = (ChatRoomMemberRoleListener) listeners.next(); - + for (ChatRoomMemberRoleListener listener : listeners) listener.memberRoleChanged(evt); - } } /** * Delivers the specified event to all registered message listeners. * @param evt the <tt>EventObject</tt> that we'd like delivered to all - * registered message listerners. + * registered message listeners. */ private void fireMessageEvent(EventObject evt) { - Iterator<ChatRoomMessageListener> listeners = null; + Iterable<ChatRoomMessageListener> listeners; synchronized (messageListeners) { - listeners = new ArrayList<ChatRoomMessageListener>(messageListeners) - .iterator(); + listeners + = new ArrayList<ChatRoomMessageListener>(messageListeners); } - while (listeners.hasNext()) + for (ChatRoomMessageListener listener : listeners) { - ChatRoomMessageListener listener - = (ChatRoomMessageListener) listeners.next(); - if (evt instanceof ChatRoomMessageDeliveredEvent) { listener.messageDelivered( (ChatRoomMessageDeliveredEvent) evt); @@ -1605,18 +1592,16 @@ public class ChatRoomJabberImpl */ private void firePropertyChangeEvent(PropertyChangeEvent evt) { - Iterator<ChatRoomPropertyChangeListener> listeners = null; + Iterable<ChatRoomPropertyChangeListener> listeners; synchronized (propertyChangeListeners) { - listeners = new ArrayList<ChatRoomPropertyChangeListener>( - propertyChangeListeners).iterator(); + listeners + = new ArrayList<ChatRoomPropertyChangeListener>( + propertyChangeListeners); } - while (listeners.hasNext()) + for (ChatRoomPropertyChangeListener listener : listeners) { - ChatRoomPropertyChangeListener listener - = (ChatRoomPropertyChangeListener) listeners.next(); - if (evt instanceof ChatRoomPropertyChangeEvent) { listener.chatRoomPropertyChanged( @@ -1639,20 +1624,16 @@ public class ChatRoomJabberImpl public void fireMemberPropertyChangeEvent( ChatRoomMemberPropertyChangeEvent evt) { - Iterator<ChatRoomMemberPropertyChangeListener> listeners = null; + Iterable<ChatRoomMemberPropertyChangeListener> listeners; synchronized (memberPropChangeListeners) { - listeners = new ArrayList<ChatRoomMemberPropertyChangeListener>( - memberPropChangeListeners).iterator(); + listeners + = new ArrayList<ChatRoomMemberPropertyChangeListener>( + memberPropChangeListeners); } - while (listeners.hasNext()) - { - ChatRoomMemberPropertyChangeListener listener - = (ChatRoomMemberPropertyChangeListener) listeners.next(); - + for (ChatRoomMemberPropertyChangeListener listener : listeners) listener.chatRoomPropertyChanged(evt); - } } /** diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/JabberAccountID.java b/src/net/java/sip/communicator/impl/protocol/jabber/JabberAccountID.java index 3450e16..70eb5e9 100755 --- a/src/net/java/sip/communicator/impl/protocol/jabber/JabberAccountID.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/JabberAccountID.java @@ -23,7 +23,7 @@ public class JabberAccountID * @param id the id identifying this account * @param accountProperties any other properties necessary for the account. */ - JabberAccountID(String id, Map accountProperties ) + JabberAccountID(String id, Map<String, String> accountProperties ) { super(id, accountProperties, ProtocolNames.JABBER, getServiceName(accountProperties)); diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetGeolocationJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetGeolocationJabberImpl.java index cbb9e37..78fd7a9 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetGeolocationJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetGeolocationJabberImpl.java @@ -84,7 +84,7 @@ public class OperationSetGeolocationJabberImpl * * @param geolocation our current Geolocation ready to be sent */ - public void publishGeolocation(Map geolocation) + public void publishGeolocation(Map<String, String> geolocation) { GeolocationPresence myGeolocPrez = new GeolocationPresence(opsetprez); @@ -107,7 +107,7 @@ public class OperationSetGeolocationJabberImpl * geolocation by its identifier. * @return the <tt>Geolocation</tt> of the contact. */ - public Map queryContactGeolocation(String contactIdentifier) + public Map<String, String> queryContactGeolocation(String contactIdentifier) { /** @todo implement queryContactGeolocation() */ return null; diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetMultiUserChatJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetMultiUserChatJabberImpl.java index 00123a7..6f278d2 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetMultiUserChatJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetMultiUserChatJabberImpl.java @@ -40,7 +40,7 @@ public class OperationSetMultiUserChatJabberImpl * we have not necessarily joined these rooms, we might have simply been * searching through them. */ - private final Hashtable<String, ChatRoom> chatRoomCache = new Hashtable(); + private final Hashtable<String, ChatRoom> chatRoomCache = new Hashtable<String, ChatRoom>(); /** * The registration listener that would get notified when the underlying @@ -204,17 +204,13 @@ public class OperationSetMultiUserChatJabberImpl { synchronized(chatRoomCache) { - List joinedRooms - = new LinkedList(this.chatRoomCache.values()); - - Iterator joinedRoomsIter = joinedRooms.iterator(); + List<ChatRoom> joinedRooms + = new LinkedList<ChatRoom>(this.chatRoomCache.values()); + Iterator<ChatRoom> joinedRoomsIter = joinedRooms.iterator(); while (joinedRoomsIter.hasNext()) - { - if ( !( (ChatRoom) joinedRoomsIter.next()).isJoined()) + if (!joinedRoomsIter.next().isJoined()) joinedRoomsIter.remove(); - } - return joinedRooms; } } @@ -275,7 +271,7 @@ public class OperationSetMultiUserChatJabberImpl { assertSupportedAndConnected(); - List list = new LinkedList(); + List<String> list = new LinkedList<String>(); //first retrieve all conference service names available on this server Iterator<String> serviceNames = null; @@ -296,7 +292,7 @@ public class OperationSetMultiUserChatJabberImpl while(serviceNames.hasNext()) { String serviceName = serviceNames.next(); - List<HostedRoom> roomsOnThisService = new LinkedList(); + List<HostedRoom> roomsOnThisService = new LinkedList<HostedRoom>(); try { @@ -506,8 +502,11 @@ public class OperationSetMultiUserChatJabberImpl Iterator<String> joinedRoomsIter = MultiUserChat.getJoinedRooms( getXmppConnection(), chatRoomMember.getContactAddress()); + List<String> joinedRooms = new ArrayList<String>(); - return (List) joinedRoomsIter; + while (joinedRoomsIter.hasNext()) + joinedRooms.add(joinedRoomsIter.next()); + return joinedRooms; } /** diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetPersistentPresenceJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetPersistentPresenceJabberImpl.java index 035aa99..603b91b 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetPersistentPresenceJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetPersistentPresenceJabberImpl.java @@ -607,7 +607,7 @@ public class OperationSetPersistentPresenceJabberImpl */ public static Presence.Mode presenceStatusToJabberMode(PresenceStatus status) { - return (Presence.Mode) scToJabberModesMappings.get(status + return scToJabberModesMappings.get(status .getStatusName()); } diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetTypingNotificationsJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetTypingNotificationsJabberImpl.java index 87702b2..bae0087 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetTypingNotificationsJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetTypingNotificationsJabberImpl.java @@ -46,7 +46,8 @@ public class OperationSetTypingNotificationsJabberImpl */ private MessageEventManager messageEventManager = null; - private Hashtable packetIDsTable = new Hashtable(); + private final Map<String, String> packetIDsTable + = new Hashtable<String, String>(); /** * The listener instance that we use to track chat states according to diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetWhiteboardingJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetWhiteboardingJabberImpl.java index 8cf9260..23e4779 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetWhiteboardingJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetWhiteboardingJabberImpl.java @@ -40,21 +40,21 @@ public class OperationSetWhiteboardingJabberImpl /** * A list of listeners subscribed for invitations multi user chat events. */ - private Vector invitationListeners = new Vector(); + private Vector<WhiteboardInvitationListener> invitationListeners = new Vector<WhiteboardInvitationListener>(); /** * A list of listeners subscribed for events indicating rejection of a * multi user chat invitation sent by us. */ - private Vector invitationRejectionListeners = new Vector(); + private Vector<WhiteboardInvitationRejectionListener> invitationRejectionListeners = new Vector<WhiteboardInvitationRejectionListener>(); /** * Listeners that will be notified of changes in our status in the * room such as us being kicked, banned, or granted admin permissions. */ - private Vector presenceListeners = new Vector(); + private Vector<WhiteboardSessionPresenceListener> presenceListeners = new Vector<WhiteboardSessionPresenceListener>(); - private Vector whiteboardSessions = new Vector(); + private Vector<WhiteboardSession> whiteboardSessions = new Vector<WhiteboardSession>(); private OperationSetPersistentPresenceJabberImpl presenceOpSet; @@ -233,19 +233,18 @@ public class OperationSetWhiteboardingJabberImpl * @return a <tt>List</tt> of the white-board sessions where the user has * joined using a given connection. */ - public List getCurrentlyJoinedWhiteboards() + public List<WhiteboardSession> getCurrentlyJoinedWhiteboards() { synchronized(whiteboardSessions) { - List joinedWhiteboards - = new LinkedList(whiteboardSessions); - - Iterator joinedWhiteboardsIter = whiteboardSessions.iterator(); + List<WhiteboardSession> joinedWhiteboards + = new LinkedList<WhiteboardSession>(whiteboardSessions); + Iterator<WhiteboardSession> joinedWhiteboardsIter + = whiteboardSessions.iterator(); while (joinedWhiteboardsIter.hasNext()) { - if (!((WhiteboardSession) joinedWhiteboardsIter.next()) - .isJoined()) + if (!joinedWhiteboardsIter.next().isJoined()) joinedWhiteboardsIter.remove(); } @@ -447,19 +446,16 @@ public class OperationSetWhiteboardingJabberImpl + invitationListeners.size() + " listeners. event is: " + evt.toString()); - Iterator listeners = null; + Iterable<WhiteboardInvitationListener> listeners; synchronized (invitationListeners) { - listeners = new ArrayList(invitationListeners).iterator(); + listeners + = new ArrayList<WhiteboardInvitationListener>( + invitationListeners); } - while (listeners.hasNext()) - { - WhiteboardInvitationListener listener - = (WhiteboardInvitationListener) listeners.next(); - + for (WhiteboardInvitationListener listener : listeners) listener.invitationReceived(evt); - } } /** @@ -482,18 +478,15 @@ public class OperationSetWhiteboardingJabberImpl eventType, reason); - Iterator listeners = null; + Iterable<WhiteboardSessionPresenceListener> listeners; synchronized (presenceListeners) { - listeners = new ArrayList(presenceListeners).iterator(); + listeners + = new ArrayList<WhiteboardSessionPresenceListener>( + presenceListeners); } - while (listeners.hasNext()) - { - WhiteboardSessionPresenceListener listener - = (WhiteboardSessionPresenceListener) listeners.next(); - + for (WhiteboardSessionPresenceListener listener : listeners) listener.whiteboardSessionPresenceChanged(evt); - } } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderFactoryJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderFactoryJabberImpl.java index fb1ace2..f53792f 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderFactoryJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderFactoryJabberImpl.java @@ -42,7 +42,7 @@ public class ProtocolProviderFactoryJabberImpl * @return the AccountID of the newly created account */ public AccountID installAccount( String userIDStr, - Map accountProperties) + Map<String, String> accountProperties) { BundleContext context = JabberActivator.getBundleContext(); @@ -89,7 +89,7 @@ public class ProtocolProviderFactoryJabberImpl return accountID; } - protected AccountID createAccountID(String userID, Map accountProperties) + protected AccountID createAccountID(String userID, Map<String, String> accountProperties) { return new JabberAccountID(userID, accountProperties); } @@ -106,7 +106,7 @@ public class ProtocolProviderFactoryJabberImpl @Override public void modifyAccount( ProtocolProviderService protocolProvider, - Map accountProperties) + Map<String, String> accountProperties) throws NullPointerException { BundleContext context @@ -128,8 +128,7 @@ public class ProtocolProviderFactoryJabberImpl if(!registeredAccounts.containsKey(accountID)) return; - ServiceRegistration registration - = (ServiceRegistration) registeredAccounts.get(accountID); + ServiceRegistration registration = registeredAccounts.get(accountID); // kill the service if (registration != null) @@ -141,7 +140,7 @@ public class ProtocolProviderFactoryJabberImpl accountProperties.put(USER_ID, accountID.getUserID()); - String serverAddress = (String) accountProperties.get(SERVER_ADDRESS); + String serverAddress = accountProperties.get(SERVER_ADDRESS); if(serverAddress == null) throw new NullPointerException("null is not a valid ServerAddress"); @@ -164,7 +163,7 @@ public class ProtocolProviderFactoryJabberImpl // and check for a password. this.storeAccount(accountID); - Hashtable properties = new Hashtable(); + Hashtable<String, String> properties = new Hashtable<String, String>(); properties.put(PROTOCOL, ProtocolNames.JABBER); properties.put(USER_ID, accountID.getUserID()); diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ServerStoredContactListJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ServerStoredContactListJabberImpl.java index 89e6692..65a562b 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ServerStoredContactListJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ServerStoredContactListJabberImpl.java @@ -148,18 +148,16 @@ public class ServerStoredContactListJabberImpl logger.trace("Will dispatch the following grp event: " + evt); - Iterator<ServerStoredGroupListener> listeners = null; + Iterable<ServerStoredGroupListener> listeners; synchronized (serverStoredGroupListeners) { - listeners = new ArrayList<ServerStoredGroupListener>( - serverStoredGroupListeners).iterator(); + listeners + = new ArrayList<ServerStoredGroupListener>( + serverStoredGroupListeners); } - while (listeners.hasNext()) + for (ServerStoredGroupListener listener : listeners) { - ServerStoredGroupListener listener - = (ServerStoredGroupListener) listeners.next(); - if (eventID == ServerStoredGroupEvent.GROUP_REMOVED_EVENT) listener.groupRemoved(evt); else if (eventID == ServerStoredGroupEvent.GROUP_RENAMED_EVENT) @@ -631,12 +629,8 @@ public class ServerStoredContactListJabberImpl // first if unfiled exntries will move them in a group if(roster.getUnfiledEntryCount() > 0) { - Iterator iter = roster.getUnfiledEntries().iterator(); - - while (iter.hasNext()) + for (RosterEntry item : roster.getUnfiledEntries()) { - RosterEntry item = (RosterEntry) iter.next(); - ContactJabberImpl contact = findContactById(item.getUser()); @@ -661,11 +655,8 @@ public class ServerStoredContactListJabberImpl } // fill in root group - Iterator iter = roster.getGroups().iterator(); - while (iter.hasNext()) + for (RosterGroup item : roster.getGroups()) { - RosterGroup item = (RosterGroup) iter.next(); - ContactGroupJabberImpl group = findContactGroup(item.getName()); @@ -780,15 +771,12 @@ public class ServerStoredContactListJabberImpl * Received event when entry is added to the serverstored list * @param addresses Collection */ - public void entriesAdded(Collection addresses) + public void entriesAdded(Collection<String> addresses) { logger.trace("entriesAdded " + addresses); - Iterator<String> iter = addresses.iterator(); - while (iter.hasNext()) + for (String id : addresses) { - String id = (String) iter.next(); - RosterEntry entry = roster.getEntry(id); ContactJabberImpl contact = @@ -806,11 +794,8 @@ public class ServerStoredContactListJabberImpl true); boolean isUnfiledEntry = true; - Iterator groupIter = entry.getGroups().iterator(); - while (groupIter.hasNext()) + for (RosterGroup group : entry.getGroups()) { - RosterGroup group = (RosterGroup) groupIter.next(); - ContactGroupJabberImpl parentGroup = findContactGroup(group.getName()); if(parentGroup != null) @@ -838,23 +823,17 @@ public class ServerStoredContactListJabberImpl * or have been added to a new group or removed from one * @param addresses Collection */ - public void entriesUpdated(Collection addresses) + public void entriesUpdated(Collection<String> addresses) { logger.trace("entriesUpdated " + addresses); // will search for group renamed - - Iterator iter = addresses.iterator(); - while (iter.hasNext()) + for (String contactID : addresses) { - String contactID = (String) iter.next(); RosterEntry entry = roster.getEntry(contactID); - Iterator iter1 = entry.getGroups().iterator(); - while (iter1.hasNext()) + for (RosterGroup gr : entry.getGroups()) { - RosterGroup gr = (RosterGroup) iter1.next(); - if(findContactGroup(gr.getName()) == null) { // such group does not exist. so it must be @@ -917,7 +896,7 @@ public class ServerStoredContactListJabberImpl Iterator<String> iter = addresses.iterator(); while (iter.hasNext()) { - String address = (String) iter.next(); + String address = iter.next(); logger.trace("entry deleted " + address); ContactJabberImpl contact = findContactById(address); diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/WhiteboardParticipantJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/WhiteboardParticipantJabberImpl.java index dff702a..84455b0 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/WhiteboardParticipantJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/WhiteboardParticipantJabberImpl.java @@ -281,7 +281,8 @@ public class WhiteboardParticipantJabberImpl * All the WhiteboardParticipant listeners registered with this * WhiteboardParticipant. */ - protected ArrayList whiteboardParticipantListeners = new ArrayList(); + protected final List<WhiteboardParticipantListener> whiteboardParticipantListeners + = new ArrayList<WhiteboardParticipantListener>(); /** * Allows the user interface to register a listener interested in changes @@ -356,18 +357,16 @@ public class WhiteboardParticipantJabberImpl + whiteboardParticipantListeners.size() + " listeners. event is: " + evt.toString()); - Iterator listeners = null; + Iterable<WhiteboardParticipantListener> listeners; synchronized (whiteboardParticipantListeners) { - listeners = - new ArrayList(whiteboardParticipantListeners).iterator(); + listeners + = new ArrayList<WhiteboardParticipantListener>( + whiteboardParticipantListeners); } - while (listeners.hasNext()) + for (WhiteboardParticipantListener listener : listeners) { - WhiteboardParticipantListener listener = - (WhiteboardParticipantListener) listeners.next(); - if (eventType .equals(WhiteboardParticipantChangeEvent.WHITEBOARD_PARTICIPANT_DISPLAY_NAME_CHANGE)) { @@ -417,4 +416,4 @@ public class WhiteboardParticipantJabberImpl this.whiteboard = session; } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/impl/protocol/mock/MockAccountID.java b/src/net/java/sip/communicator/impl/protocol/mock/MockAccountID.java index 09cd643..930c13f 100644 --- a/src/net/java/sip/communicator/impl/protocol/mock/MockAccountID.java +++ b/src/net/java/sip/communicator/impl/protocol/mock/MockAccountID.java @@ -19,7 +19,7 @@ public class MockAccountID protected MockAccountID(String userName) { super( userName - , new java.util.Hashtable() + , new java.util.Hashtable<String, String>() , ProtocolNames.SIP_COMMUNICATOR_MOCK , MOCK_SERVICE_NAME); } diff --git a/src/net/java/sip/communicator/impl/protocol/mock/MockChatRoom.java b/src/net/java/sip/communicator/impl/protocol/mock/MockChatRoom.java index 0cc892e..d387b13 100644 --- a/src/net/java/sip/communicator/impl/protocol/mock/MockChatRoom.java +++ b/src/net/java/sip/communicator/impl/protocol/mock/MockChatRoom.java @@ -29,37 +29,37 @@ public class MockChatRoom private boolean joined = false; - private List members = new Vector(); + private List<ChatRoomMember> members = new Vector<ChatRoomMember>(); /** * Currently registered member presence listeners. */ - private Vector memberPresenceListeners = new Vector(); + private final List<ChatRoomMemberPresenceListener> memberPresenceListeners + = new Vector<ChatRoomMemberPresenceListener>(); /** * Currently registered local user role listeners. */ - private Vector localUserRoleListeners = new Vector(); + private final List<ChatRoomLocalUserRoleListener> localUserRoleListeners + = new Vector<ChatRoomLocalUserRoleListener>(); /** * Currently registered member role listeners. */ - private Vector memberRoleListeners = new Vector(); + private final List<ChatRoomMemberRoleListener> memberRoleListeners + = new Vector<ChatRoomMemberRoleListener>(); /** * Currently registered property change listeners. */ - private Vector propertyChangeListeners = new Vector(); - - /** - * Currently registered property change listeners. - */ - private Vector memberPropChangeListeners = new Vector(); + private final List<ChatRoomPropertyChangeListener> propertyChangeListeners + = new Vector<ChatRoomPropertyChangeListener>(); /** * Currently registered message listeners. */ - private Vector messageListeners = new Vector(); + private final List<ChatRoomMessageListener> messageListeners + = new Vector<ChatRoomMessageListener>(); public MockChatRoom( MockProvider provider, @@ -373,7 +373,7 @@ public class MockChatRoom * @return a <tt>List</tt> of <tt>ChatRoomMember</tt> instances * corresponding to all room members. */ - public List getMembers() + public List<ChatRoomMember> getMembers() { return members; } @@ -456,14 +456,8 @@ public class MockChatRoom ChatRoomMessageDeliveredEvent .CONVERSATION_MESSAGE_DELIVERED); - Iterator iter = messageListeners.iterator(); - while(iter.hasNext()) - { - ChatRoomMessageListener elem = - (ChatRoomMessageListener)iter.next(); - + for (ChatRoomMessageListener elem : messageListeners) elem.messageDelivered(evt); - } } /** @@ -484,9 +478,9 @@ public class MockChatRoom * * @return an Iterator over a set of ban masks for this chat room */ - public Iterator getBanList() + public Iterator<ChatRoomMember> getBanList() { - return new Vector().iterator(); + return new Vector<ChatRoomMember>().iterator(); } /** @@ -499,10 +493,8 @@ public class MockChatRoom public void deliverMessage(Message msg, String from) { ChatRoomMember fromMember = null; - Iterator iter = members.iterator(); - while(iter.hasNext()) + for (ChatRoomMember elem : members) { - ChatRoomMember elem = (ChatRoomMember)iter.next(); if(elem.getName().equals(from)) { fromMember = elem; @@ -521,15 +513,9 @@ public class MockChatRoom msg, ChatRoomMessageReceivedEvent .CONVERSATION_MESSAGE_RECEIVED); - - iter = messageListeners.iterator(); - while(iter.hasNext()) - { - ChatRoomMessageListener elem = - (ChatRoomMessageListener)iter.next(); - - elem.messageReceived(evt); - } + + for (ChatRoomMessageListener elem : messageListeners) + elem.messageReceived(evt); } /** @@ -606,4 +592,4 @@ public class MockChatRoom { return true; } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/impl/protocol/mock/MockContactGroup.java b/src/net/java/sip/communicator/impl/protocol/mock/MockContactGroup.java index 66064e7..98581ee 100644 --- a/src/net/java/sip/communicator/impl/protocol/mock/MockContactGroup.java +++ b/src/net/java/sip/communicator/impl/protocol/mock/MockContactGroup.java @@ -21,8 +21,8 @@ public class MockContactGroup { private String groupName = null; - private Vector contacts = new Vector(); - private Vector subGroups = new Vector(); + private final List<Contact> contacts = new Vector<Contact>(); + private final List<ContactGroup> subGroups = new Vector<ContactGroup>(); private MockContactGroup parentGroup = null; private boolean isPersistent = true; private MockProvider parentProvider = null; @@ -69,7 +69,7 @@ public class MockContactGroup * @return a java.util.Iterator over all contacts inside this * <tt>ContactGroup</tt> */ - public Iterator contacts() + public Iterator<Contact> contacts() { return contacts.iterator(); } @@ -159,7 +159,7 @@ public class MockContactGroup if ( subGroups.contains(mockGroup) ) return this; - Iterator subGroupsIter = subgroups(); + Iterator<ContactGroup> subGroupsIter = subgroups(); while (subGroupsIter.hasNext()) { MockContactGroup subgroup = (MockContactGroup) subGroupsIter.next(); @@ -183,7 +183,7 @@ public class MockContactGroup if ( contacts.contains(mockContact) ) return this; - Iterator subGroupsIter = subgroups(); + Iterator<ContactGroup> subGroupsIter = subgroups(); while (subGroupsIter.hasNext()) { MockContactGroup subgroup = (MockContactGroup) subGroupsIter.next(); @@ -206,10 +206,10 @@ public class MockContactGroup */ public Contact getContact(String id) { - Iterator contactsIter = contacts(); + Iterator<Contact> contactsIter = contacts(); while (contactsIter.hasNext()) { - MockContact contact = (MockContact) contactsIter.next(); + Contact contact = contactsIter.next(); if (contact.getAddress().equals(id)) return contact; @@ -225,7 +225,7 @@ public class MockContactGroup */ public ContactGroup getGroup(int index) { - return (ContactGroup)subGroups.get(index); + return subGroups.get(index); } /** @@ -236,11 +236,11 @@ public class MockContactGroup */ public ContactGroup getGroup(String groupName) { - Iterator groupsIter = subgroups(); + Iterator<ContactGroup> groupsIter = subgroups(); while (groupsIter.hasNext()) { - MockContactGroup contactGroup - = (MockContactGroup) groupsIter.next(); + ContactGroup contactGroup = groupsIter.next(); + if (contactGroup.getGroupName().equals(groupName)) return contactGroup; @@ -275,7 +275,7 @@ public class MockContactGroup * @return a java.util.Iterator over the <tt>ContactGroup</tt> children * of this group (i.e. subgroups). */ - public Iterator subgroups() + public Iterator<ContactGroup> subgroups() { return subGroups.iterator(); } @@ -298,7 +298,7 @@ public class MockContactGroup public MockContact findContactByID(String id) { //first go through the contacts that are direct children. - Iterator contactsIter = contacts(); + Iterator<Contact> contactsIter = contacts(); while(contactsIter.hasNext()) { @@ -309,12 +309,11 @@ public class MockContactGroup } //if we didn't find it here, let's try in the subougroups - Iterator groupsIter = subgroups(); + Iterator<ContactGroup> groupsIter = subgroups(); while( groupsIter.hasNext() ) { MockContactGroup mGroup = (MockContactGroup)groupsIter.next(); - MockContact mContact = mGroup.findContactByID(id); if (mContact != null) @@ -332,14 +331,13 @@ public class MockContactGroup */ public String toString() { - StringBuffer buff = new StringBuffer(getGroupName()); buff.append(".subGroups=" + countSubgroups() + ":\n"); - Iterator subGroups = subgroups(); + Iterator<ContactGroup> subGroups = subgroups(); while (subGroups.hasNext()) { - MockContactGroup group = (MockContactGroup)subGroups.next(); + ContactGroup group = subGroups.next(); buff.append(group.toString()); if (subGroups.hasNext()) buff.append("\n"); @@ -347,10 +345,10 @@ public class MockContactGroup buff.append("\nChildContacts="+countContacts()+":["); - Iterator contacts = contacts(); + Iterator<Contact> contacts = contacts(); while (contacts.hasNext()) { - MockContact contact = (MockContact) contacts.next(); + Contact contact = contacts.next(); buff.append(contact.toString()); if(contacts.hasNext()) buff.append(", "); @@ -462,7 +460,7 @@ public class MockContactGroup return false; //traverse child contacts - Iterator theirContacts = mockGroup.contacts(); + Iterator<Contact> theirContacts = mockGroup.contacts(); while(theirContacts.hasNext()) { @@ -477,7 +475,7 @@ public class MockContactGroup } //traverse subgroups - Iterator theirSubgroups = mockGroup.subgroups(); + Iterator<ContactGroup> theirSubgroups = mockGroup.subgroups(); while(theirSubgroups.hasNext()) { diff --git a/src/net/java/sip/communicator/impl/protocol/mock/MockMultiUserChat.java b/src/net/java/sip/communicator/impl/protocol/mock/MockMultiUserChat.java index 5971272..2753817 100644 --- a/src/net/java/sip/communicator/impl/protocol/mock/MockMultiUserChat.java +++ b/src/net/java/sip/communicator/impl/protocol/mock/MockMultiUserChat.java @@ -9,7 +9,6 @@ package net.java.sip.communicator.impl.protocol.mock; import java.util.*; import net.java.sip.communicator.service.protocol.*; -import net.java.sip.communicator.service.protocol.event.*; /** * Multiuser chat functionalities for the mock protocol. @@ -23,8 +22,8 @@ public class MockMultiUserChat */ private MockProvider provider = null; - private List existingChatRooms = new Vector(); - private List joinedChatRooms = new Vector(); + private final List<ChatRoom> existingChatRooms = new Vector<ChatRoom>(); + private final List<ChatRoom> joinedChatRooms = new Vector<ChatRoom>(); /** * Creates an instance of this operation set keeping a reference to the @@ -46,16 +45,21 @@ public class MockMultiUserChat * rooms that are currently available on the server that this protocol * provider is connected to. * - * @throws OperationFailedException if we faile retrieving this list from + * @throws OperationFailedException if we failed retrieving this list from * the server. * @throws OperationNotSupportedException if the server does not support * multi user chat */ - public List getExistingChatRooms() + public List<String> getExistingChatRooms() throws OperationFailedException, OperationNotSupportedException { - return existingChatRooms; + List<String> existingChatRoomNames + = new ArrayList<String>(existingChatRooms.size()); + + for (ChatRoom existingChatRoom : existingChatRooms) + existingChatRoomNames.add(existingChatRoom.getName()); + return existingChatRoomNames; } /** @@ -65,7 +69,7 @@ public class MockMultiUserChat * @return a <tt>List</tt> of the rooms where the user has joined using a * given connection. */ - public List getCurrentlyJoinedChatRooms() + public List<ChatRoom> getCurrentlyJoinedChatRooms() { return joinedChatRooms; } @@ -84,21 +88,15 @@ public class MockMultiUserChat * @throws OperationNotSupportedException if the server does not support * multi user chat */ - public List getCurrentlyJoinedChatRooms(ChatRoomMember chatRoomMember) + public List<String> getCurrentlyJoinedChatRooms(ChatRoomMember chatRoomMember) throws OperationFailedException, OperationNotSupportedException { - List result = new Vector(); - - Iterator iter = joinedChatRooms.iterator(); - - while(iter.hasNext()) - { - ChatRoom elem = (ChatRoom)iter.next(); - if(elem.getMembers().contains(chatRoomMember)) - result.add(elem); - } + List<String> result = new Vector<String>(); + for (ChatRoom elem : joinedChatRooms) + if (elem.getMembers().contains(chatRoomMember)) + result.add(elem.getName()); return result; } @@ -148,14 +146,9 @@ public class MockMultiUserChat throws OperationFailedException, OperationNotSupportedException { - Iterator iter = existingChatRooms.iterator(); - while(iter.hasNext()) - { - ChatRoom elem = (ChatRoom)iter.next(); + for (ChatRoom elem : existingChatRooms) if(elem.getName().equals(roomName)) return elem; - } - return null; } diff --git a/src/net/java/sip/communicator/impl/protocol/mock/MockProvider.java b/src/net/java/sip/communicator/impl/protocol/mock/MockProvider.java index ee70987..0c14b75 100644 --- a/src/net/java/sip/communicator/impl/protocol/mock/MockProvider.java +++ b/src/net/java/sip/communicator/impl/protocol/mock/MockProvider.java @@ -151,8 +151,7 @@ public class MockProvider */ public OperationSet getOperationSet(Class<? extends OperationSet> opsetClass) { - return (OperationSet) getSupportedOperationSets() - .get(opsetClass.getName()); + return getSupportedOperationSets().get(opsetClass.getName()); } /** diff --git a/src/net/java/sip/communicator/impl/protocol/msn/ChatRoomMsnImpl.java b/src/net/java/sip/communicator/impl/protocol/msn/ChatRoomMsnImpl.java index 7191b7b..2decb7a 100644 --- a/src/net/java/sip/communicator/impl/protocol/msn/ChatRoomMsnImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/msn/ChatRoomMsnImpl.java @@ -815,8 +815,7 @@ public class ChatRoomMsnImpl while (listeners.hasNext()) { - ChatRoomMessageListener listener = - (ChatRoomMessageListener) listeners.next(); + ChatRoomMessageListener listener = listeners.next(); if (evt instanceof ChatRoomMessageDeliveredEvent) { @@ -901,8 +900,7 @@ public class ChatRoomMsnImpl while (listeners.hasNext()) { - ChatRoomMemberPresenceListener listener = - (ChatRoomMemberPresenceListener) listeners.next(); + ChatRoomMemberPresenceListener listener = listeners.next(); listener.memberPresenceChanged(evt); } diff --git a/src/net/java/sip/communicator/impl/protocol/msn/MsnAccountID.java b/src/net/java/sip/communicator/impl/protocol/msn/MsnAccountID.java index f83584b..5580928 100755 --- a/src/net/java/sip/communicator/impl/protocol/msn/MsnAccountID.java +++ b/src/net/java/sip/communicator/impl/protocol/msn/MsnAccountID.java @@ -17,7 +17,7 @@ public class MsnAccountID * @param id the id identifying this account * @param accountProperties any other properties necessary for the account. */ - MsnAccountID(String id, Map accountProperties ) + MsnAccountID(String id, Map<String, String> accountProperties ) { super(id, accountProperties, ProtocolNames.MSN, "msn.com"); } diff --git a/src/net/java/sip/communicator/impl/protocol/msn/MsnActivator.java b/src/net/java/sip/communicator/impl/protocol/msn/MsnActivator.java index 25c7317..223fea6 100644 --- a/src/net/java/sip/communicator/impl/protocol/msn/MsnActivator.java +++ b/src/net/java/sip/communicator/impl/protocol/msn/MsnActivator.java @@ -44,7 +44,7 @@ public class MsnActivator { MsnActivator.bundleContext = context; - Hashtable hashtable = new Hashtable(); + Hashtable<String, String> hashtable = new Hashtable<String, String>(); hashtable.put(ProtocolProviderFactory.PROTOCOL, ProtocolNames.MSN); msnProviderFactory = new ProtocolProviderFactoryMsnImpl(); diff --git a/src/net/java/sip/communicator/impl/protocol/msn/OperationSetMultiUserChatMsnImpl.java b/src/net/java/sip/communicator/impl/protocol/msn/OperationSetMultiUserChatMsnImpl.java index 7a7ccdb..857fb5c 100644 --- a/src/net/java/sip/communicator/impl/protocol/msn/OperationSetMultiUserChatMsnImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/msn/OperationSetMultiUserChatMsnImpl.java @@ -31,12 +31,12 @@ public class OperationSetMultiUserChatMsnImpl * A list of the rooms that are currently open by this account. Note that * this list only contains chat rooms where the user is not the initiator. */ - private Hashtable chatRoomCache = new Hashtable(); + private Hashtable<String, ChatRoom> chatRoomCache = new Hashtable<String, ChatRoom>(); /** * A list of the rooms that are currently open and created by this account. */ - private Hashtable userCreatedChatRoomList = new Hashtable(); + private Hashtable<Object, ChatRoom> userCreatedChatRoomList = new Hashtable<Object, ChatRoom>(); /** * The currently valid MSN protocol provider service implementation. @@ -129,7 +129,7 @@ public class OperationSetMultiUserChatMsnImpl { assertConnected(); - ChatRoom room = (ChatRoom) chatRoomCache.get(roomName); + ChatRoom room = chatRoomCache.get(roomName); if (room == null) { // when the room hasn't been created, we create it. @@ -259,17 +259,17 @@ public class OperationSetMultiUserChatMsnImpl * @return a <tt>List</tt> of the rooms where the user has joined using a * given connection. */ - public List getCurrentlyJoinedChatRooms() + public List<ChatRoom> getCurrentlyJoinedChatRooms() { synchronized (chatRoomCache) { - List joinedRooms = new LinkedList(this.chatRoomCache.values()); + List<ChatRoom> joinedRooms = new LinkedList<ChatRoom>(this.chatRoomCache.values()); - Iterator joinedRoomsIter = joinedRooms.iterator(); + Iterator<ChatRoom> joinedRoomsIter = joinedRooms.iterator(); while (joinedRoomsIter.hasNext()) { - if (!((ChatRoom) joinedRoomsIter.next()).isJoined()) + if (!joinedRoomsIter.next().isJoined()) joinedRoomsIter.remove(); } @@ -290,22 +290,19 @@ public class OperationSetMultiUserChatMsnImpl * @throws OperationNotSupportedException if the server does not support * multi user chat */ - public List getCurrentlyJoinedChatRooms(ChatRoomMember chatRoomMember) + public List<String> getCurrentlyJoinedChatRooms( + ChatRoomMember chatRoomMember) throws OperationFailedException, - OperationNotSupportedException + OperationNotSupportedException { synchronized (chatRoomCache) { - List joinedRooms = new LinkedList(this.chatRoomCache.values()); - - Iterator joinedRoomsIter = joinedRooms.iterator(); - - while (joinedRoomsIter.hasNext()) - { - if (!((ChatRoom) joinedRoomsIter.next()).isJoined()) - joinedRoomsIter.remove(); - } + List<String> joinedRooms = new LinkedList<String>(); + for (Map.Entry<String, ChatRoom> chatRoomEntry + : chatRoomCache.entrySet()) + if (chatRoomEntry.getValue().isJoined()) + joinedRooms.add(chatRoomEntry.getKey()); return joinedRooms; } } @@ -314,13 +311,12 @@ public class OperationSetMultiUserChatMsnImpl * Note: This is not supported inside the MSN, so we just return an empty * list. */ - public List getExistingChatRooms() + public List<String> getExistingChatRooms() throws OperationFailedException, OperationNotSupportedException { // we dont have any available chat rooms on the server. - - return new LinkedList(); + return new LinkedList<String>(); } /** @@ -730,11 +726,11 @@ public class OperationSetMultiUserChatMsnImpl */ private void updateChatRoomMembers(Contact contact) { - Enumeration<ChatRoomMsnImpl> chatRooms = chatRoomCache.elements(); + Enumeration<ChatRoom> chatRooms = chatRoomCache.elements(); while (chatRooms.hasMoreElements()) { - ChatRoomMsnImpl chatRoom = chatRooms.nextElement(); + ChatRoomMsnImpl chatRoom = (ChatRoomMsnImpl)chatRooms.nextElement(); ChatRoomMemberMsnImpl member = chatRoom.findMemberForAddress(contact.getAddress()); diff --git a/src/net/java/sip/communicator/impl/protocol/msn/OperationSetPersistentPresenceMsnImpl.java b/src/net/java/sip/communicator/impl/protocol/msn/OperationSetPersistentPresenceMsnImpl.java index 6123105..025b585 100644 --- a/src/net/java/sip/communicator/impl/protocol/msn/OperationSetPersistentPresenceMsnImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/msn/OperationSetPersistentPresenceMsnImpl.java @@ -368,10 +368,10 @@ public class OperationSetPersistentPresenceMsnImpl // any status information about the contacts in our list) if(ssContactList.isInitialized()) parentProvider.getMessenger().getOwner(). - setStatus((MsnUserStatus)scToMsnModesMappings.get(status)); + setStatus(scToMsnModesMappings.get(status)); else parentProvider.getMessenger().getOwner(). - setInitStatus((MsnUserStatus)scToMsnModesMappings.get(status)); + setInitStatus(scToMsnModesMappings.get(status)); } /** @@ -729,7 +729,7 @@ public class OperationSetPersistentPresenceMsnImpl Iterator<String> iter = earlyStatusChange.keySet().iterator(); while (iter.hasNext()) { - String contactEmail = (String)iter.next(); + String contactEmail = iter.next(); ContactMsnImpl sourceContact = ssContactList.findContactById(contactEmail); @@ -743,8 +743,7 @@ public class OperationSetPersistentPresenceMsnImpl = sourceContact.getPresenceStatus(); PresenceStatus newStatus - = msnStatusToPresenceStatus((MsnUserStatus) - earlyStatusChange.get(contactEmail)); + = msnStatusToPresenceStatus(earlyStatusChange.get(contactEmail)); // when old and new status are the same do nothing // no change diff --git a/src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderFactoryMsnImpl.java b/src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderFactoryMsnImpl.java index 3229282..049d09a 100644 --- a/src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderFactoryMsnImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderFactoryMsnImpl.java @@ -41,7 +41,7 @@ public class ProtocolProviderFactoryMsnImpl * @return the AccountID of the newly created account */ public AccountID installAccount( String userIDStr, - Map accountProperties) + Map<String, String> accountProperties) { BundleContext context = MsnActivator.getBundleContext(); @@ -74,7 +74,7 @@ public class ProtocolProviderFactoryMsnImpl return accountID; } - protected AccountID createAccountID(String userID, Map accountProperties) + protected AccountID createAccountID(String userID, Map<String, String> accountProperties) { return new MsnAccountID(userID, accountProperties); } @@ -91,7 +91,7 @@ public class ProtocolProviderFactoryMsnImpl @Override public void modifyAccount( ProtocolProviderService protocolProvider, - Map accountProperties) + Map<String, String> accountProperties) throws NullPointerException { BundleContext context @@ -112,8 +112,7 @@ public class ProtocolProviderFactoryMsnImpl if(!registeredAccounts.containsKey(accountID)) return; - ServiceRegistration registration - = (ServiceRegistration) registeredAccounts.get(accountID); + ServiceRegistration registration = registeredAccounts.get(accountID); // kill the service if (registration != null) @@ -136,7 +135,7 @@ public class ProtocolProviderFactoryMsnImpl // and check for a password. this.storeAccount(accountID); - Hashtable properties = new Hashtable(); + Hashtable<String, String> properties = new Hashtable<String, String>(); properties.put(PROTOCOL, ProtocolNames.MSN); properties.put(USER_ID, accountID.getUserID()); diff --git a/src/net/java/sip/communicator/impl/protocol/rss/ContactGroupRssImpl.java b/src/net/java/sip/communicator/impl/protocol/rss/ContactGroupRssImpl.java index ca4f668..51021f0 100644 --- a/src/net/java/sip/communicator/impl/protocol/rss/ContactGroupRssImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/rss/ContactGroupRssImpl.java @@ -32,12 +32,12 @@ public class ContactGroupRssImpl /** * The list of this group's members. */ - private Vector contacts = new Vector(); + private Vector<Contact> contacts = new Vector<Contact>(); /** * The list of sub groups belonging to this group. */ - private Vector subGroups = new Vector(); + private Vector<ContactGroup> subGroups = new Vector<ContactGroup>(); /** * The group that this group belongs to (or null if this is the root group). @@ -115,7 +115,7 @@ public class ContactGroupRssImpl * @return a java.util.Iterator over all contacts inside this * <tt>ContactGroup</tt> */ - public Iterator contacts() + public Iterator<Contact> contacts() { return contacts.iterator(); } @@ -206,7 +206,7 @@ public class ContactGroupRssImpl if ( subGroups.contains(rssGroup) ) return this; - Iterator subGroupsIter = subgroups(); + Iterator<ContactGroup> subGroupsIter = subgroups(); while (subGroupsIter.hasNext()) { ContactGroupRssImpl subgroup @@ -235,7 +235,7 @@ public class ContactGroupRssImpl if ( contacts.contains(rssContact) ) return this; - Iterator subGroupsIter = subgroups(); + Iterator<ContactGroup> subGroupsIter = subgroups(); while (subGroupsIter.hasNext()) { ContactGroupRssImpl subgroup @@ -261,7 +261,7 @@ public class ContactGroupRssImpl */ public Contact getContact(String id) { - Iterator contactsIter = contacts(); + Iterator<Contact> contactsIter = contacts(); while (contactsIter.hasNext()) { ContactRssImpl contact = (ContactRssImpl) contactsIter.next(); @@ -280,7 +280,7 @@ public class ContactGroupRssImpl */ public ContactGroup getGroup(int index) { - return (ContactGroup)subGroups.get(index); + return subGroups.get(index); } /** @@ -291,7 +291,7 @@ public class ContactGroupRssImpl */ public ContactGroup getGroup(String groupName) { - Iterator groupsIter = subgroups(); + Iterator<ContactGroup> groupsIter = subgroups(); while (groupsIter.hasNext()) { ContactGroupRssImpl contactGroup @@ -330,7 +330,7 @@ public class ContactGroupRssImpl * @return a java.util.Iterator over the <tt>ContactGroup</tt> children * of this group (i.e. subgroups). */ - public Iterator subgroups() + public Iterator<ContactGroup> subgroups() { return subGroups.iterator(); } @@ -353,7 +353,7 @@ public class ContactGroupRssImpl public ContactRssImpl findContactByID(String id) { //first go through the contacts that are direct children. - Iterator contactsIter = contacts(); + Iterator<Contact> contactsIter = contacts(); while(contactsIter.hasNext()) { @@ -364,7 +364,7 @@ public class ContactGroupRssImpl } //if we didn't find it here, let's try in the subougroups - Iterator groupsIter = subgroups(); + Iterator<ContactGroup> groupsIter = subgroups(); while( groupsIter.hasNext() ) { @@ -391,7 +391,7 @@ public class ContactGroupRssImpl StringBuffer buff = new StringBuffer(getGroupName()); buff.append(".subGroups=" + countSubgroups() + ":\n"); - Iterator subGroups = subgroups(); + Iterator<ContactGroup> subGroups = subgroups(); while (subGroups.hasNext()) { ContactGroupRssImpl group = (ContactGroupRssImpl)subGroups.next(); @@ -402,7 +402,7 @@ public class ContactGroupRssImpl buff.append("\nChildContacts="+countContacts()+":["); - Iterator contacts = contacts(); + Iterator<Contact> contacts = contacts(); while (contacts.hasNext()) { ContactRssImpl contact = (ContactRssImpl) contacts.next(); @@ -418,7 +418,7 @@ public class ContactGroupRssImpl //StringBuffer buff = new StringBuffer(getGroupName()); //buff.append(".subGroups=" + countSubgroups() + ":\n"); - Iterator subGroups = subgroups(); + Iterator<ContactGroup> subGroups = subgroups(); while (subGroups.hasNext()) { ContactGroupRssImpl group = (ContactGroupRssImpl)subGroups.next(); @@ -430,7 +430,7 @@ public class ContactGroupRssImpl //buff.append("\nChildContacts="+countContacts()+":["); - Iterator contacts = contacts(); + Iterator<Contact> contacts = contacts(); while (contacts.hasNext()) { ContactRssImpl contact = (ContactRssImpl) contacts.next(); @@ -567,7 +567,7 @@ public class ContactGroupRssImpl return false; //traverse child contacts - Iterator theirContacts = rssGroup.contacts(); + Iterator<Contact> theirContacts = rssGroup.contacts(); while(theirContacts.hasNext()) { @@ -583,7 +583,7 @@ public class ContactGroupRssImpl } //traverse subgroups - Iterator theirSubgroups = rssGroup.subgroups(); + Iterator<ContactGroup> theirSubgroups = rssGroup.subgroups(); while(theirSubgroups.hasNext()) { diff --git a/src/net/java/sip/communicator/impl/protocol/rss/ImageRetriever.java b/src/net/java/sip/communicator/impl/protocol/rss/ImageRetriever.java index 3cc85b6..0139d42 100644 --- a/src/net/java/sip/communicator/impl/protocol/rss/ImageRetriever.java +++ b/src/net/java/sip/communicator/impl/protocol/rss/ImageRetriever.java @@ -80,7 +80,7 @@ public class ImageRetriever extends Thread .iterator(); while (iter.hasNext()) { - ContactRssImpl contact = (ContactRssImpl) iter.next(); + ContactRssImpl contact = iter.next(); byte[] imgBytes = getAvatar(contact); diff --git a/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderFactoryRssImpl.java b/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderFactoryRssImpl.java index 294e543..823d039 100644 --- a/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderFactoryRssImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderFactoryRssImpl.java @@ -43,7 +43,7 @@ public class ProtocolProviderFactoryRssImpl * @return the AccountID of the newly created account. */ public AccountID installAccount( String userIDStr, - Map accountProperties) + Map<String, String> accountProperties) { BundleContext context = RssActivator.getBundleContext(); @@ -76,7 +76,7 @@ public class ProtocolProviderFactoryRssImpl return accountID; } - protected AccountID createAccountID(String userID, Map accountProperties) + protected AccountID createAccountID(String userID, Map<String, String> accountProperties) { return new RssAccountID(userID, accountProperties); } @@ -93,7 +93,7 @@ public class ProtocolProviderFactoryRssImpl @Override public void modifyAccount( ProtocolProviderService protocolProvider, - Map accountProperties) + Map<String, String> accountProperties) throws NullPointerException { // TODO Auto-generated method stub diff --git a/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderServiceRssImpl.java b/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderServiceRssImpl.java index f0b61d3..0ab7624 100644 --- a/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderServiceRssImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderServiceRssImpl.java @@ -108,9 +108,7 @@ public class ProtocolProviderServiceRssImpl //OperationSetBasicInstantMessagingRssImpl basicInstantMessaging = new OperationSetBasicInstantMessagingRssImpl( - this - , (OperationSetPersistentPresenceRssImpl) - persistentPresence); + this, persistentPresence); supportedOperationSets.put( OperationSetBasicInstantMessaging.class.getName(), diff --git a/src/net/java/sip/communicator/impl/protocol/rss/RssAccountID.java b/src/net/java/sip/communicator/impl/protocol/rss/RssAccountID.java index 243aafc..650808f 100644 --- a/src/net/java/sip/communicator/impl/protocol/rss/RssAccountID.java +++ b/src/net/java/sip/communicator/impl/protocol/rss/RssAccountID.java @@ -7,7 +7,7 @@ package net.java.sip.communicator.impl.protocol.rss; import net.java.sip.communicator.service.protocol.*; -import java.util.Map; +import java.util.*; /** * The Rss implementation of a sip-communicator account id. @@ -22,7 +22,7 @@ public class RssAccountID * @param userID the user identifier correspnding to the account * @param accountProperties any other properties necessary for the account. */ - RssAccountID(String userID, Map accountProperties) + RssAccountID(String userID, Map<String, String> accountProperties) { super( userID, accountProperties, diff --git a/src/net/java/sip/communicator/impl/protocol/rss/RssActivator.java b/src/net/java/sip/communicator/impl/protocol/rss/RssActivator.java index d00e031..d6f3a62 100644 --- a/src/net/java/sip/communicator/impl/protocol/rss/RssActivator.java +++ b/src/net/java/sip/communicator/impl/protocol/rss/RssActivator.java @@ -79,7 +79,7 @@ public class RssActivator { this.bundleContext = context; - Hashtable hashtable = new Hashtable(); + Hashtable<String, String> hashtable = new Hashtable<String, String>(); hashtable.put(ProtocolProviderFactory.PROTOCOL, "RSS"); rssProviderFactory = new ProtocolProviderFactoryRssImpl(); diff --git a/src/net/java/sip/communicator/impl/protocol/rss/RssFeedReader.java b/src/net/java/sip/communicator/impl/protocol/rss/RssFeedReader.java index a5a64cc..baeb9c4 100644 --- a/src/net/java/sip/communicator/impl/protocol/rss/RssFeedReader.java +++ b/src/net/java/sip/communicator/impl/protocol/rss/RssFeedReader.java @@ -278,7 +278,7 @@ public class RssFeedReader return rssURL.toString(); } - private static class SyndEntryComparator implements Comparator + private static class SyndEntryComparator implements Comparator<SyndEntry> { /** * Compares its two items for order. Returns a negative integer, @@ -293,10 +293,10 @@ public class RssFeedReader * @throws ClassCastException if one of the objects is not a * SyndEntry instance. */ - public int compare(Object o1, Object o2) + public int compare(SyndEntry o1, SyndEntry o2) { - Date date1 = ( (SyndEntry) o1).getPublishedDate(); - Date date2 = ( (SyndEntry) o2).getPublishedDate(); + Date date1 = o1.getPublishedDate(); + Date date2 = o2.getPublishedDate(); if (date1 == null || date2 == null) { diff --git a/src/net/java/sip/communicator/impl/protocol/sip/ClientCapabilities.java b/src/net/java/sip/communicator/impl/protocol/sip/ClientCapabilities.java index b9ea935..73b70a7 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/ClientCapabilities.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/ClientCapabilities.java @@ -72,7 +72,7 @@ public class ClientCapabilities //add to the allows header all methods that we support while(supportedMethods.hasNext()) { - String method = (String)supportedMethods.next(); + String method = supportedMethods.next(); //don't support REGISTERs if(method.equals(Request.REGISTER)) @@ -282,7 +282,7 @@ public class ClientCapabilities //add to the allows header all methods that we support while(supportedMethods.hasNext()) { - String method = (String)supportedMethods.next(); + String method = supportedMethods.next(); //don't support REGISTERs if(method.equals(Request.REGISTER)) @@ -299,7 +299,7 @@ public class ClientCapabilities { while (events.hasNext()) { - String event = (String) events.next(); + String event = events.next(); request.addHeader(provider.getHeaderFactory() .createAllowEventsHeader(event)); diff --git a/src/net/java/sip/communicator/impl/protocol/sip/ContactGroupSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/ContactGroupSipImpl.java index f836981..64739dc 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/ContactGroupSipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/ContactGroupSipImpl.java @@ -285,7 +285,7 @@ public class ContactGroupSipImpl */ public ContactGroup getGroup(int index) { - return (ContactGroup)subGroups.get(index); + return subGroups.get(index); } /** diff --git a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderFactorySipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderFactorySipImpl.java index 70e75dc..057cba3 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderFactorySipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderFactorySipImpl.java @@ -134,8 +134,7 @@ public class ProtocolProviderFactorySipImpl if(!registeredAccounts.containsKey(accountID)) return; - ServiceRegistration registration - = (ServiceRegistration) registeredAccounts.get(accountID); + ServiceRegistration registration = registeredAccounts.get(accountID); // kill the service if (registration != null) diff --git a/src/net/java/sip/communicator/impl/protocol/sip/SipAccountID.java b/src/net/java/sip/communicator/impl/protocol/sip/SipAccountID.java index c17953b..730d021 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/SipAccountID.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/SipAccountID.java @@ -39,11 +39,11 @@ public class SipAccountID * @param accountProperties any other properties necessary for the account. * @param serverName the name of the server that the user belongs to. */ - protected SipAccountID(String userID, Map accountProperties, + protected SipAccountID(String userID, Map<String, String> accountProperties, String serverName) { super(stripServerNameFromUserID(userID), accountProperties, - (String) accountProperties.get(ProtocolProviderFactory.PROTOCOL), + accountProperties.get(ProtocolProviderFactory.PROTOCOL), serverName); } diff --git a/src/net/java/sip/communicator/impl/protocol/sip/SipStackSharing.java b/src/net/java/sip/communicator/impl/protocol/sip/SipStackSharing.java index 5237363..9bf1f8c 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/SipStackSharing.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/SipStackSharing.java @@ -775,7 +775,7 @@ public class SipStackSharing // one of ours usernames for(ProtocolProviderServiceSipImpl listener : currentListeners) { - String ourUserID = (String) listener.getAccountID().getUserID(); + String ourUserID = listener.getAccountID().getUserID(); //logger.trace(ourUserID + " *** " + requestUser); if(ourUserID.equals(requestUser)) { diff --git a/src/net/java/sip/communicator/impl/protocol/sip/security/CredentialsCache.java b/src/net/java/sip/communicator/impl/protocol/sip/security/CredentialsCache.java index 450cfd4..d9b9018 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/security/CredentialsCache.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/security/CredentialsCache.java @@ -27,12 +27,12 @@ class CredentialsCache /** * Contains call->realms mappings */ - private Hashtable authenticatedRealms = new Hashtable(); + private Hashtable<String, CredentialsCacheEntry> authenticatedRealms = new Hashtable<String, CredentialsCacheEntry>(); /** * Contains callid->authorization header mappings */ - private Hashtable authenticatedCalls = new Hashtable(); + private Hashtable<String, AuthorizationHeader> authenticatedCalls = new Hashtable<String, AuthorizationHeader>(); /** * Cache credentials for the specified call and realm @@ -55,7 +55,7 @@ class CredentialsCache */ CredentialsCacheEntry get(String realm) { - return (CredentialsCacheEntry)this.authenticatedRealms.get(realm); + return this.authenticatedRealms.get(realm); } /** @@ -68,7 +68,7 @@ class CredentialsCache */ CredentialsCacheEntry remove(String realm) { - return (CredentialsCacheEntry)this.authenticatedRealms.remove(realm); + return this.authenticatedRealms.remove(realm); } /** @@ -104,7 +104,7 @@ class CredentialsCache */ AuthorizationHeader getCachedAuthorizationHeader(String callid) { - return (AuthorizationHeader)this.authenticatedCalls.get(callid); + return this.authenticatedCalls.get(callid); } } diff --git a/src/net/java/sip/communicator/impl/protocol/sip/security/CredentialsCacheEntry.java b/src/net/java/sip/communicator/impl/protocol/sip/security/CredentialsCacheEntry.java index 5e0778a..8d1b51b 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/security/CredentialsCacheEntry.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/security/CredentialsCacheEntry.java @@ -28,7 +28,7 @@ class CredentialsCacheEntry * has not reached this class). The transactionHistory's elements are Strings * corresponding to branch ids. */ - private Vector transactionHistory = new Vector(); + private Vector<String> transactionHistory = new Vector<String>(); /** * Adds the specified branch id to the transaction history list so that we diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/ContactGroupSSHImpl.java b/src/net/java/sip/communicator/impl/protocol/ssh/ContactGroupSSHImpl.java index 7552e01..3555b6a 100644 --- a/src/net/java/sip/communicator/impl/protocol/ssh/ContactGroupSSHImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/ssh/ContactGroupSSHImpl.java @@ -36,12 +36,12 @@ public class ContactGroupSSHImpl /** * The list of this group's members. */ - private Vector contacts = new Vector(); + private Vector<Contact> contacts = new Vector<Contact>(); /** * The list of sub groups belonging to this group. */ - private Vector subGroups = new Vector(); + private Vector<ContactGroup> subGroups = new Vector<ContactGroup>(); /** * The group that this group belongs to (or null if this is the root group). @@ -119,7 +119,7 @@ public class ContactGroupSSHImpl * @return a java.util.Iterator over all contacts inside this * <tt>ContactGroup</tt> */ - public Iterator contacts() + public Iterator<Contact> contacts() { return contacts.iterator(); } @@ -211,7 +211,7 @@ public class ContactGroupSSHImpl if ( subGroups.contains(sshGroup) ) return this; - Iterator subGroupsIter = subgroups(); + Iterator<ContactGroup> subGroupsIter = subgroups(); while (subGroupsIter.hasNext()) { ContactGroupSSHImpl subgroup @@ -240,7 +240,7 @@ public class ContactGroupSSHImpl if ( contacts.contains(sshContact) ) return this; - Iterator subGroupsIter = subgroups(); + Iterator<ContactGroup> subGroupsIter = subgroups(); while (subGroupsIter.hasNext()) { ContactGroupSSHImpl subgroup @@ -266,7 +266,7 @@ public class ContactGroupSSHImpl */ public Contact getContact(String id) { - Iterator contactsIter = contacts(); + Iterator<Contact> contactsIter = contacts(); while (contactsIter.hasNext()) { ContactSSHImpl contact = (ContactSSHImpl) contactsIter.next(); @@ -285,7 +285,7 @@ public class ContactGroupSSHImpl */ public ContactGroup getGroup(int index) { - return (ContactGroup)subGroups.get(index); + return subGroups.get(index); } /** @@ -296,7 +296,7 @@ public class ContactGroupSSHImpl */ public ContactGroup getGroup(String groupName) { - Iterator groupsIter = subgroups(); + Iterator<ContactGroup> groupsIter = subgroups(); while (groupsIter.hasNext()) { ContactGroupSSHImpl contactGroup @@ -335,7 +335,7 @@ public class ContactGroupSSHImpl * @return a java.util.Iterator over the <tt>ContactGroup</tt> children * of this group (i.e. subgroups). */ - public Iterator subgroups() + public Iterator<ContactGroup> subgroups() { return subGroups.iterator(); } diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/OperationSetPersistentPresenceSSHImpl.java b/src/net/java/sip/communicator/impl/protocol/ssh/OperationSetPersistentPresenceSSHImpl.java index 4c9d94e..2b5f52e 100644 --- a/src/net/java/sip/communicator/impl/protocol/ssh/OperationSetPersistentPresenceSSHImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/ssh/OperationSetPersistentPresenceSSHImpl.java @@ -745,7 +745,7 @@ public class OperationSetPersistentPresenceSSHImpl */ public List findContactsPointingToUs() { - List contacts = new LinkedList(); + List<Contact> contacts = new LinkedList<Contact>(); BundleContext bc = SSHActivator.getBundleContext(); String osgiQuery = diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderFactorySSHImpl.java b/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderFactorySSHImpl.java index 30f837c..85b08dd 100644 --- a/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderFactorySSHImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderFactorySSHImpl.java @@ -48,7 +48,7 @@ public class ProtocolProviderFactorySSHImpl */ public AccountID installAccount( String userIDStr, - Map accountProperties) + Map<String, String> accountProperties) { BundleContext context = SSHActivator.getBundleContext(); if (context == null) @@ -104,7 +104,7 @@ public class ProtocolProviderFactorySSHImpl return accountID; } - protected AccountID createAccountID(String userID, Map accountProperties) + protected AccountID createAccountID(String userID, Map<String, String> accountProperties) { return new SSHAccountID(userID, accountProperties); } @@ -160,7 +160,7 @@ public class ProtocolProviderFactorySSHImpl @Override public void modifyAccount( ProtocolProviderService protocolProvider, - Map accountProperties) + Map<String, String> accountProperties) throws NullPointerException { // TODO Auto-generated method stub diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/SSHAccountID.java b/src/net/java/sip/communicator/impl/protocol/ssh/SSHAccountID.java index 982fafc..88c74b4 100644 --- a/src/net/java/sip/communicator/impl/protocol/ssh/SSHAccountID.java +++ b/src/net/java/sip/communicator/impl/protocol/ssh/SSHAccountID.java @@ -28,7 +28,7 @@ public class SSHAccountID * @param userID the user identifier correspnding to thi account * @param accountProperties any other properties necessary for the account. */ - SSHAccountID(String userID, Map accountProperties) + SSHAccountID(String userID, Map<String, String> accountProperties) { super(userID , accountProperties diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/SSHActivator.java b/src/net/java/sip/communicator/impl/protocol/ssh/SSHActivator.java index 36f8a5d..f360923 100644 --- a/src/net/java/sip/communicator/impl/protocol/ssh/SSHActivator.java +++ b/src/net/java/sip/communicator/impl/protocol/ssh/SSHActivator.java @@ -65,7 +65,7 @@ public class SSHActivator { this.bundleContext = context; - Hashtable hashtable = new Hashtable(); + Hashtable<String, String> hashtable = new Hashtable<String, String>(); hashtable.put(ProtocolProviderFactory.PROTOCOL, "SSH"); sshProviderFactory = new ProtocolProviderFactorySSHImpl(); diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/ChatRoomYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/ChatRoomYahooImpl.java index 2fa2966..883c166 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/ChatRoomYahooImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/ChatRoomYahooImpl.java @@ -84,8 +84,8 @@ public class ChatRoomYahooImpl implements ChatRoom /** * The list of members of this chat room. */ - private Hashtable<String, ChatRoomMemberYahooImpl> members - = new Hashtable<String, ChatRoomMemberYahooImpl>(); + private Hashtable<String, ChatRoomMember> members + = new Hashtable<String, ChatRoomMember>(); /** * The list of members of this chat room. @@ -302,9 +302,9 @@ public class ChatRoomYahooImpl implements ChatRoom * @return a <tt>List</tt> of <tt>Member</tt> corresponding to all room * members. */ - public List getMembers() + public List<ChatRoomMember> getMembers() { - return new LinkedList(members.values()); + return new LinkedList<ChatRoomMember>(members.values()); } /** @@ -652,16 +652,15 @@ public class ChatRoomYahooImpl implements ChatRoom { provider.getYahooSession().leaveConference(yahooConference); - Iterator< Map.Entry<String, ChatRoomMemberYahooImpl>> membersSet + Iterator< Map.Entry<String, ChatRoomMember>> membersSet = members.entrySet().iterator(); while (membersSet.hasNext()) { - Map.Entry<String, ChatRoomMemberYahooImpl> memberEntry - = (Map.Entry<String, ChatRoomMemberYahooImpl>) membersSet - .next(); + Map.Entry<String, ChatRoomMember> memberEntry + = membersSet.next(); - ChatRoomMember member = (ChatRoomMember) memberEntry.getValue(); + ChatRoomMember member = memberEntry.getValue(); fireMemberPresenceEvent(member, ChatRoomMemberPresenceChangeEvent.MEMBER_LEFT, @@ -785,7 +784,7 @@ public class ChatRoomYahooImpl implements ChatRoom */ public ChatRoomMemberYahooImpl getChatRoomMember(String userAddress) { - Iterator<ChatRoomMemberYahooImpl> it = members.values().iterator(); + Iterator<ChatRoomMember> it = members.values().iterator(); while (it.hasNext()) { @@ -818,8 +817,7 @@ public class ChatRoomYahooImpl implements ChatRoom while (listeners.hasNext()) { - ChatRoomMessageListener listener - = (ChatRoomMessageListener) listeners.next(); + ChatRoomMessageListener listener = listeners.next(); if (evt instanceof ChatRoomMessageDeliveredEvent) { @@ -864,8 +862,7 @@ public class ChatRoomYahooImpl implements ChatRoom while (listeners.hasNext()) { - ChatRoomMemberPresenceListener listener - = (ChatRoomMemberPresenceListener) listeners.next(); + ChatRoomMemberPresenceListener listener = listeners.next(); listener.memberPresenceChanged(evt); } diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetMultiUserChatYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetMultiUserChatYahooImpl.java index 3b99806..b773158 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetMultiUserChatYahooImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetMultiUserChatYahooImpl.java @@ -206,7 +206,7 @@ public class OperationSetMultiUserChatYahooImpl while (joinedRoomsIter.hasNext()) { - if (!((ChatRoom) joinedRoomsIter.next()).isJoined()) + if (!joinedRoomsIter.next().isJoined()) joinedRoomsIter.remove(); } diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderFactoryYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderFactoryYahooImpl.java index 505763e..7e57be6 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderFactoryYahooImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderFactoryYahooImpl.java @@ -41,7 +41,7 @@ public class ProtocolProviderFactoryYahooImpl * @return the AccountID of the newly created account */ public AccountID installAccount( String userIDStr, - Map accountProperties) + Map<String, String> accountProperties) { BundleContext context = YahooActivator.getBundleContext(); @@ -74,7 +74,7 @@ public class ProtocolProviderFactoryYahooImpl return accountID; } - protected AccountID createAccountID(String userID, Map accountProperties) + protected AccountID createAccountID(String userID, Map<String, String> accountProperties) { return new YahooAccountID(userID, accountProperties); } @@ -91,7 +91,7 @@ public class ProtocolProviderFactoryYahooImpl @Override public void modifyAccount( ProtocolProviderService protocolProvider, - Map accountProperties) + Map<String, String> accountProperties) throws NullPointerException { BundleContext context @@ -113,8 +113,7 @@ public class ProtocolProviderFactoryYahooImpl if(!registeredAccounts.containsKey(accountID)) return; - ServiceRegistration registration - = (ServiceRegistration) registeredAccounts.get(accountID); + ServiceRegistration registration = registeredAccounts.get(accountID); // kill the service if (registration != null) @@ -137,7 +136,7 @@ public class ProtocolProviderFactoryYahooImpl // and check for a password. this.storeAccount(accountID); - Hashtable properties = new Hashtable(); + Hashtable<String, String> properties = new Hashtable<String, String>(); properties.put(PROTOCOL, ProtocolNames.YAHOO); properties.put(USER_ID, accountID.getUserID()); diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/YahooAccountID.java b/src/net/java/sip/communicator/impl/protocol/yahoo/YahooAccountID.java index bc524f3..afdbfe9 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/YahooAccountID.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/YahooAccountID.java @@ -23,7 +23,7 @@ public class YahooAccountID * @param id the id identifying this account * @param accountProperties any other properties necessary for the account. */ - YahooAccountID(String id, Map accountProperties ) + YahooAccountID(String id, Map<String, String> accountProperties ) { super(YahooSession.getYahooUserID(id), accountProperties, ProtocolNames.YAHOO, "yahoo.com"); diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/YahooActivator.java b/src/net/java/sip/communicator/impl/protocol/yahoo/YahooActivator.java index b5c7c1f..c674356 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/YahooActivator.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/YahooActivator.java @@ -43,7 +43,7 @@ public class YahooActivator public void start(BundleContext context) throws Exception { this.bundleContext = context; - Hashtable hashtable = new Hashtable(); + Hashtable<String, String> hashtable = new Hashtable<String, String>(); hashtable.put(ProtocolProviderFactory.PROTOCOL, ProtocolNames.YAHOO); yahooProviderFactory = new ProtocolProviderFactoryYahooImpl(); diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/BonjourService.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/BonjourService.java index 5e896d3..a5370f4 100644 --- a/src/net/java/sip/communicator/impl/protocol/zeroconf/BonjourService.java +++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/BonjourService.java @@ -27,11 +27,11 @@ public class BonjourService extends Thread Logger.getLogger(BonjourService.class); private int port = 5298; - private ServerSocket sock=null; - private String id; + private ServerSocket sock = null; + private String id = null; private JmDNS jmdns=null; - private Hashtable props; - private ServiceInfo service; + private final Map<String, Object> props = new Hashtable<String, Object>(); + private ServiceInfo service = null; private boolean dead = false; private final List<ContactZeroconfImpl> contacts @@ -81,8 +81,6 @@ public class BonjourService extends Thread (OperationSetPersistentPresenceZeroconfImpl) pps .getOperationSet(OperationSetPersistentPresence.class); - props = new Hashtable(); - // Gaim props.put("1st", acc.getFirst()); props.put("email", (acc.getMail() == null)? "":acc.getMail()); @@ -456,10 +454,10 @@ public class BonjourService extends Thread logger.debug(" Address=>"+info.getAddress() +":"+info.getPort()); - for (Enumeration names = info.getPropertyNames() ; - names.hasMoreElements() ; ) + for (Iterator<String> names = info.getPropertyNames(); + names.hasNext();) { - String prop = (String)names.nextElement(); + String prop = names.next(); logger.debug(" "+prop+"=>" +info.getPropertyString(prop)); } diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/ContactGroupZeroconfImpl.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/ContactGroupZeroconfImpl.java index 976e2fd..935f4cb 100644 --- a/src/net/java/sip/communicator/impl/protocol/zeroconf/ContactGroupZeroconfImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/ContactGroupZeroconfImpl.java @@ -34,12 +34,12 @@ public class ContactGroupZeroconfImpl /** * The list of this group's members. */ - private Vector contacts = new Vector(); + private Vector<Contact> contacts = new Vector<Contact>(); /** * The list of sub groups belonging to this group. */ - private Vector subGroups = new Vector(); + private Vector<ContactGroup> subGroups = new Vector<ContactGroup>(); /** * The group that this group belongs to (or null if this is the root group). @@ -117,7 +117,7 @@ public class ContactGroupZeroconfImpl * @return a java.util.Iterator over all contacts inside this * <tt>ContactGroup</tt> */ - public Iterator contacts() + public Iterator<Contact> contacts() { return contacts.iterator(); } @@ -209,7 +209,7 @@ public class ContactGroupZeroconfImpl if ( subGroups.contains(zeroconfGroup) ) return this; - Iterator subGroupsIter = subgroups(); + Iterator<ContactGroup> subGroupsIter = subgroups(); while (subGroupsIter.hasNext()) { ContactGroupZeroconfImpl subgroup @@ -238,7 +238,7 @@ public class ContactGroupZeroconfImpl if ( contacts.contains(zeroconfContact) ) return this; - Iterator subGroupsIter = subgroups(); + Iterator<ContactGroup> subGroupsIter = subgroups(); while (subGroupsIter.hasNext()) { ContactGroupZeroconfImpl subgroup @@ -264,7 +264,7 @@ public class ContactGroupZeroconfImpl */ public Contact getContact(String id) { - Iterator contactsIter = contacts(); + Iterator<Contact> contactsIter = contacts(); while (contactsIter.hasNext()) { ContactZeroconfImpl contact = @@ -285,7 +285,7 @@ public class ContactGroupZeroconfImpl */ public ContactGroup getGroup(int index) { - return (ContactGroup)subGroups.get(index); + return subGroups.get(index); } /** @@ -296,7 +296,7 @@ public class ContactGroupZeroconfImpl */ public ContactGroup getGroup(String groupName) { - Iterator groupsIter = subgroups(); + Iterator<ContactGroup> groupsIter = subgroups(); while (groupsIter.hasNext()) { ContactGroupZeroconfImpl contactGroup @@ -335,7 +335,7 @@ public class ContactGroupZeroconfImpl * @return a java.util.Iterator over the <tt>ContactGroup</tt> children * of this group (i.e. subgroups). */ - public Iterator subgroups() + public Iterator<ContactGroup> subgroups() { return subGroups.iterator(); } @@ -358,7 +358,7 @@ public class ContactGroupZeroconfImpl public ContactZeroconfImpl findContactByID(String id) { //first go through the contacts that are direct children. - Iterator contactsIter = contacts(); + Iterator<Contact> contactsIter = contacts(); while(contactsIter.hasNext()) { @@ -370,7 +370,7 @@ public class ContactGroupZeroconfImpl } //if we didn't find it here, let's try in the subougroups - Iterator groupsIter = subgroups(); + Iterator<ContactGroup> groupsIter = subgroups(); while( groupsIter.hasNext() ) { @@ -398,7 +398,7 @@ public class ContactGroupZeroconfImpl StringBuffer buff = new StringBuffer(getGroupName()); buff.append(".subGroups=" + countSubgroups() + ":\n"); - Iterator subGroups = subgroups(); + Iterator<ContactGroup> subGroups = subgroups(); while (subGroups.hasNext()) { ContactGroupZeroconfImpl group = @@ -410,7 +410,7 @@ public class ContactGroupZeroconfImpl buff.append("\nChildContacts="+countContacts()+":["); - Iterator contacts = contacts(); + Iterator<Contact> contacts = contacts(); while (contacts.hasNext()) { ContactZeroconfImpl contact = (ContactZeroconfImpl) contacts.next(); @@ -545,7 +545,7 @@ public class ContactGroupZeroconfImpl return false; //traverse child contacts - Iterator theirContacts = zeroconfGroup.contacts(); + Iterator<Contact> theirContacts = zeroconfGroup.contacts(); while(theirContacts.hasNext()) { @@ -561,7 +561,7 @@ public class ContactGroupZeroconfImpl } //traverse subgroups - Iterator theirSubgroups = zeroconfGroup.subgroups(); + Iterator<ContactGroup> theirSubgroups = zeroconfGroup.subgroups(); while(theirSubgroups.hasNext()) { diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderFactoryZeroconfImpl.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderFactoryZeroconfImpl.java index c22eeae..80b4c05 100644 --- a/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderFactoryZeroconfImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderFactoryZeroconfImpl.java @@ -44,7 +44,7 @@ public class ProtocolProviderFactoryZeroconfImpl * @return the AccountID of the newly created account. */ public AccountID installAccount( String userIDStr, - Map accountProperties) + Map<String, String> accountProperties) { BundleContext context = ZeroconfActivator.getBundleContext(); @@ -81,7 +81,7 @@ public class ProtocolProviderFactoryZeroconfImpl return accountID; } - protected AccountID createAccountID(String userID, Map accountProperties) + protected AccountID createAccountID(String userID, Map<String, String> accountProperties) { return new ZeroconfAccountID(userID, accountProperties); } @@ -98,7 +98,7 @@ public class ProtocolProviderFactoryZeroconfImpl @Override public void modifyAccount( ProtocolProviderService protocolProvider, - Map accountProperties) + Map<String, String> accountProperties) throws NullPointerException { // TODO Auto-generated method stub diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/ZeroconfAccountID.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/ZeroconfAccountID.java index 199591c..dd592f2 100644 --- a/src/net/java/sip/communicator/impl/protocol/zeroconf/ZeroconfAccountID.java +++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/ZeroconfAccountID.java @@ -30,19 +30,19 @@ public class ZeroconfAccountID * @param userID id identifying this account * @param accountProperties any other properties necessary for the account. */ - ZeroconfAccountID(String userID, Map accountProperties) + ZeroconfAccountID(String userID, Map<String, String> accountProperties) { super(userID, accountProperties, ProtocolNames.ZEROCONF, "zeroconf.org"); - first = (String)accountProperties.get("first"); - last = (String)accountProperties.get("last"); - mail = (String)accountProperties.get("mail"); + first = accountProperties.get("first"); + last = accountProperties.get("last"); + mail = accountProperties.get("mail"); rememberContacts = - new Boolean((String)accountProperties.get("rememberContacts")) + new Boolean(accountProperties.get("rememberContacts")) .booleanValue(); } diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSCache.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSCache.java index 65a9a48..f6608f7 100644 --- a/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSCache.java +++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSCache.java @@ -69,7 +69,7 @@ class DNSCache * name. * Values are linked lists of CacheNode instances. */ - private HashMap hashtable; + private HashMap<String, CacheNode> hashtable; /** * Cache nodes are used to implement storage of multiple DNSEntry's of the @@ -86,7 +86,7 @@ class DNSCache this.value = value; String SLevel = System.getProperty("jmdns.debug"); if (SLevel == null) SLevel = "INFO"; - this.logger.setLevel(Level.parse(SLevel)); + logger.setLevel(Level.parse(SLevel)); } public CacheNode next() @@ -107,7 +107,7 @@ class DNSCache */ public DNSCache(final int size) { - hashtable = new HashMap(size); + hashtable = new HashMap<String, CacheNode>(size); String SLevel = System.getProperty("jmdns.debug"); if (SLevel == null) SLevel = "INFO"; @@ -131,7 +131,7 @@ class DNSCache { //logger.log("DNSCache.add("+entry.getName()+")"); CacheNode newValue = new CacheNode(entry); - CacheNode node = (CacheNode) hashtable.get(entry.getName()); + CacheNode node = hashtable.get(entry.getName()); if (node == null) { hashtable.put(entry.getName(), newValue); @@ -151,7 +151,7 @@ class DNSCache */ public synchronized boolean remove(DNSEntry entry) { - CacheNode node = (CacheNode) hashtable.get(entry.getName()); + CacheNode node = hashtable.get(entry.getName()); if (node != null) { if (node.value == entry) @@ -244,7 +244,7 @@ class DNSCache */ public synchronized CacheNode find(String name) { - return (CacheNode) hashtable.get(name); + return hashtable.get(name); } /** @@ -252,9 +252,9 @@ class DNSCache */ public synchronized void print() { - for (Iterator i = iterator(); i.hasNext();) + for (Iterator<CacheNode> i = iterator(); i.hasNext();) { - for (CacheNode n = (CacheNode) i.next(); n != null; n = n.next) + for (CacheNode n = i.next(); n != null; n = n.next) { logger.info(n.value.toString()); } @@ -265,9 +265,9 @@ class DNSCache { StringBuffer aLog = new StringBuffer(); aLog.append("\t---- cache ----"); - for (Iterator i = iterator(); i.hasNext();) + for (Iterator<CacheNode> i = iterator(); i.hasNext();) { - for (CacheNode n = (CacheNode) i.next(); n != null; n = n.next) + for (CacheNode n = i.next(); n != null; n = n.next) { aLog.append("\n\t\t" + n.value); } diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSOutgoing.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSOutgoing.java index 6eb3782..44e9687 100644 --- a/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSOutgoing.java +++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSOutgoing.java @@ -25,7 +25,7 @@ final class DNSOutgoing private int numAnswers; private int numAuthorities; private int numAdditionals; - private Hashtable names; + private Hashtable<String, Integer> names; byte data[]; int off; @@ -51,7 +51,7 @@ final class DNSOutgoing this.flags = flags; this.multicast = multicast; - names = new Hashtable(); + names = new Hashtable<String, Integer>(); data = new byte[DNSConstants.MAX_MSG_TYPICAL]; off = 12; } @@ -117,7 +117,7 @@ final class DNSOutgoing } } - private LinkedList authorativeAnswers = new LinkedList(); + private LinkedList<DNSRecord> authorativeAnswers = new LinkedList<DNSRecord>(); /** * Add an authorative answer to the message. @@ -246,7 +246,7 @@ final class DNSOutgoing writeByte(0); return; } - Integer offset = (Integer) names.get(name); + Integer offset = names.get(name); if (offset != null) { int val = offset.intValue(); diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSRecord.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSRecord.java index c009a91..35c0769 100644 --- a/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSRecord.java +++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSRecord.java @@ -5,7 +5,6 @@ package net.java.sip.communicator.impl.protocol.zeroconf.jmdns; import java.io.*; import java.net.*; -import java.util.*; import java.util.logging.*; /** @@ -97,7 +96,7 @@ public abstract class DNSRecord extends DNSEntry { for (int i = msg.numAnswers; i-- > 0;) { - if (suppressedBy((DNSRecord) msg.answers.get(i))) + if (suppressedBy(msg.answers.get(i))) { return true; } @@ -355,12 +354,8 @@ public abstract class DNSRecord extends DNSEntry // We lost the tie-break. We have to choose a different name. dns.getLocalHost().incrementHostName(); dns.getCache().clear(); - for (Iterator i = dns.services.values().iterator(); - i.hasNext();) - { - ServiceInfo info = (ServiceInfo) i.next(); + for (ServiceInfo info : dns.services.values()) info.revertState(); - } } dns.revertState(); return true; @@ -388,12 +383,8 @@ public abstract class DNSRecord extends DNSEntry { dns.getLocalHost().incrementHostName(); dns.getCache().clear(); - for (Iterator i = dns.services.values().iterator(); - i.hasNext();) - { - ServiceInfo info = (ServiceInfo) i.next(); + for (ServiceInfo info : dns.services.values()) info.revertState(); - } } dns.revertState(); return true; @@ -663,7 +654,7 @@ public abstract class DNSRecord extends DNSEntry boolean handleQuery(JmDNS dns, long expirationTime) { - ServiceInfo info = (ServiceInfo) dns.services.get(name.toLowerCase()); + ServiceInfo info = dns.services.get(name.toLowerCase()); if (info != null && (port != info.port || !server.equalsIgnoreCase(dns.getLocalHost().getName()))) @@ -700,7 +691,7 @@ public abstract class DNSRecord extends DNSEntry boolean handleResponse(JmDNS dns) { - ServiceInfo info = (ServiceInfo) dns.services.get(name.toLowerCase()); + ServiceInfo info = dns.services.get(name.toLowerCase()); if (info != null && (port != info.port || !server.equalsIgnoreCase(dns.getLocalHost().getName()))) { @@ -729,7 +720,7 @@ public abstract class DNSRecord extends DNSEntry DNSOutgoing out) throws IOException { - ServiceInfo info = (ServiceInfo) dns.services.get(name.toLowerCase()); + ServiceInfo info = dns.services.get(name.toLowerCase()); if (info != null) { if (this.port == info.port != server.equals(dns.getLocalHost().getName())) diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSState.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSState.java index 08068eb..095873e 100644 --- a/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSState.java +++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSState.java @@ -69,7 +69,7 @@ public class DNSState public final DNSState advance() { return (isProbing() || isAnnouncing()) ? - (DNSState) sequence.get(ordinal + 1) : + sequence.get(ordinal + 1) : this; } @@ -121,4 +121,4 @@ public class DNSState { return ordinal - state.ordinal; } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/JmDNS.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/JmDNS.java index 7b9c86f..30ac500 100644 --- a/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/JmDNS.java +++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/JmDNS.java @@ -59,7 +59,7 @@ public class JmDNS /** * Holds instances of ServiceTypeListener's. */ - private List typeListeners; + private List<ServiceTypeListener> typeListeners; /** @@ -73,7 +73,7 @@ public class JmDNS * fully qualified service name. * Values are instances of ServiceInfo. */ - Map services; + Map<String, ServiceInfo> services; /** * This hashtable holds the service types that have been registered or @@ -82,11 +82,7 @@ public class JmDNS * fully qualified service type. * Values hold the fully qualified service type. */ - Map serviceTypes; - /** - * This is the shutdown hook, we registered with the java runtime. - */ - private Thread shutdown; + Map<String, String> serviceTypes; /** * Handle on the local host @@ -159,7 +155,7 @@ public class JmDNS * * @see #list */ - private HashMap serviceCollectors = new HashMap(); + private HashMap<String, ServiceCollector> serviceCollectors = new HashMap<String, ServiceCollector>(); /** * Create an instance of JmDNS. @@ -168,7 +164,7 @@ public class JmDNS public JmDNS() throws IOException { - String SLevel = System.getProperty("jmdns.debug"); + //String SLevel = System.getProperty("jmdns.debug"); logger.debug("JmDNS instance created"); try @@ -224,12 +220,12 @@ public class JmDNS cache = new DNSCache(100); - listeners = Collections.synchronizedList(new ArrayList()); - serviceListeners = new HashMap(); - typeListeners = new ArrayList(); + listeners = Collections.synchronizedList(new ArrayList<DNSListener>()); + serviceListeners = new HashMap<String, List<ServiceListener>>(); + typeListeners = new ArrayList<ServiceTypeListener>(); - services = new Hashtable(20); - serviceTypes = new Hashtable(20); + services = new Hashtable<String, ServiceInfo>(20); + serviceTypes = new Hashtable<String, String>(20); // REMIND: If I could pass in a name for the Timer thread, // I would pass 'JmDNS.Timer'. @@ -244,16 +240,16 @@ public class JmDNS start(services.values()); } - private void start(Collection serviceInfos) + private void start(Collection<ServiceInfo> serviceInfos) { state = DNSState.PROBING_1; incomingListener.start(); new Prober().start(); - for (Iterator iterator = serviceInfos.iterator(); iterator.hasNext();) + for (ServiceInfo serviceInfo : serviceInfos) { try { - registerService(new ServiceInfo((ServiceInfo) iterator.next())); + registerService(new ServiceInfo(serviceInfo)); } catch (Exception exception) { @@ -489,17 +485,16 @@ public class JmDNS void handleServiceResolved(ServiceInfo info) { - List list = (List) serviceListeners.get(info.type.toLowerCase()); + List<ServiceListener> list = serviceListeners.get(info.type.toLowerCase()); if (list != null) { ServiceEvent event = new ServiceEvent(this, info.type, info.getName(), info); // Iterate on a copy in case listeners will modify it - final ArrayList listCopy = new ArrayList(list); - for (Iterator iterator = listCopy.iterator(); iterator.hasNext();) - { - ((ServiceListener) iterator.next()).serviceResolved(event); - } + List<ServiceListener> listCopy + = new ArrayList<ServiceListener> (list); + for (ServiceListener serviceListener : listCopy) + serviceListener.serviceResolved(event); } } @@ -519,11 +514,10 @@ public class JmDNS } // report cached service types - for (Iterator iterator = serviceTypes.values().iterator(); - iterator.hasNext();) + for (String serviceType : serviceTypes.values()) { listener.serviceTypeAdded( - new ServiceEvent(this, (String) iterator.next(), null, null)); + new ServiceEvent(this, serviceType, null, null)); } new TypeResolver().start(); @@ -560,17 +554,16 @@ public class JmDNS list = serviceListeners.get(lotype); if (list == null) { - list = Collections.synchronizedList(new LinkedList()); + list = Collections.synchronizedList(new LinkedList<ServiceListener>()); serviceListeners.put(lotype, list); } list.add(listener); } // report cached service types - for (Iterator i = cache.iterator(); i.hasNext();) + for (Iterator<DNSCache.CacheNode> i = cache.iterator(); i.hasNext();) { - for (DNSCache.CacheNode n = - (DNSCache.CacheNode) i.next(); n != null; n = n.next()) + for (DNSCache.CacheNode n = i.next(); n != null; n = n.next()) { DNSRecord rec = (DNSRecord) n.getValue(); if (rec.type == DNSConstants.TYPE_SRV) @@ -699,15 +692,15 @@ public class JmDNS return; } - Collection list; + Collection<ServiceInfo> list; synchronized (this) { - list = new LinkedList(services.values()); + list = new LinkedList<ServiceInfo>(services.values()); services.clear(); } - for (Iterator iterator = list.iterator(); iterator.hasNext();) + for (Iterator<ServiceInfo> iterator = list.iterator(); iterator.hasNext();) { - ((ServiceInfo) iterator.next()).cancel(); + iterator.next().cancel(); } @@ -728,8 +721,6 @@ public class JmDNS { // empty } - - } /** @@ -746,18 +737,16 @@ public class JmDNS if ((type.indexOf("._mdns._udp.") < 0) && !type.endsWith(".in-addr.arpa.")) { - Collection list; + Collection<ServiceTypeListener> list; synchronized (this) { serviceTypes.put(name, type); - list = new LinkedList(typeListeners); + list = new LinkedList<ServiceTypeListener>(typeListeners); } - for (Iterator iterator = list.iterator(); iterator.hasNext();) - { - ((ServiceTypeListener) iterator.next()). - serviceTypeAdded( + for (ServiceTypeListener listener : list) + listener + .serviceTypeAdded( new ServiceEvent(this, type, null, null)); - } } } } @@ -901,24 +890,20 @@ public class JmDNS //System.out.println("OUT OF MUTEX!!!!!"); - for (Iterator<DNSListener> iterator = listenerList.iterator(); - iterator.hasNext();) - { - DNSListener listener = (DNSListener) iterator.next(); + for (DNSListener listener : listenerList) listener.updateRecord(this, now, rec); - } + if (rec.type == DNSConstants.TYPE_PTR || rec.type == DNSConstants.TYPE_SRV) { - List serviceListenerList = null; + List<ServiceListener> serviceListenerList = null; synchronized (this) { - serviceListenerList = - (List) serviceListeners.get(rec.name.toLowerCase()); + serviceListenerList = serviceListeners.get(rec.name.toLowerCase()); // Iterate on a copy in case listeners will modify it if (serviceListenerList != null) { - serviceListenerList = new ArrayList(serviceListenerList); + serviceListenerList = new ArrayList<ServiceListener>(serviceListenerList); } } if (serviceListenerList != null) @@ -936,10 +921,10 @@ public class JmDNS type, toUnqualifiedName(type, name), null); - for (Iterator iterator = serviceListenerList.iterator(); + for (Iterator<ServiceListener> iterator = serviceListenerList.iterator(); iterator.hasNext();) { - ((ServiceListener) iterator.next()).serviceAdded(event); + iterator.next().serviceAdded(event); } } else @@ -951,11 +936,10 @@ public class JmDNS type, toUnqualifiedName(type, name), null); - for (Iterator iterator = serviceListenerList.iterator(); + for (Iterator<ServiceListener> iterator = serviceListenerList.iterator(); iterator.hasNext();) { - ((ServiceListener) iterator.next()). - serviceRemoved(event); + iterator.next().serviceRemoved(event); } } } @@ -976,16 +960,15 @@ public class JmDNS logger.trace("JMDNS/handleResponse received " + msg.answers.size()+ " messages"); - for (Iterator i = msg.answers.iterator(); i.hasNext();) - { DNSRecord rec = (DNSRecord)i.next(); + for (DNSRecord rec : msg.answers) + { logger.trace("PRINT: "+ rec); //cache.add(rec); } - for (Iterator i = msg.answers.iterator(); i.hasNext();) + for (DNSRecord rec : msg.answers) { boolean isInformative = false; - DNSRecord rec = (DNSRecord) i.next(); boolean expired = rec.isExpired(now); logger.trace("JMDNS received : " + rec + " expired: "+expired); @@ -1097,9 +1080,8 @@ public class JmDNS boolean serviceConflictDetected = false; long expirationTime = System.currentTimeMillis() + DNSConstants.KNOWN_ANSWER_TTL; - for (Iterator i = in.answers.iterator(); i.hasNext();) + for (DNSRecord answer : in.answers) { - DNSRecord answer = (DNSRecord) i.next(); if ((answer.getType() == DNSConstants.TYPE_A) || (answer.getType() == DNSConstants.TYPE_AAAA)) { @@ -1345,10 +1327,10 @@ public class JmDNS // Associate services to this, if they need probing synchronized (JmDNS.this) { - for (Iterator iterator = services.values().iterator(); + for (Iterator<ServiceInfo> iterator = services.values().iterator(); iterator.hasNext();) { - ServiceInfo info = (ServiceInfo) iterator.next(); + ServiceInfo info = iterator.next(); if (info.getState() == DNSState.PROBING_1) { info.task = this; @@ -1447,14 +1429,14 @@ public class JmDNS // Defensively copy the services into a local list, // to prevent race conditions with methods registerService // and unregisterService. - List list; + List<ServiceInfo> list; synchronized (JmDNS.this) { - list = new LinkedList(services.values()); + list = new LinkedList<ServiceInfo>(services.values()); } - for (Iterator i = list.iterator(); i.hasNext();) + for (Iterator<ServiceInfo> i = list.iterator(); i.hasNext();) { - ServiceInfo info = (ServiceInfo) i.next(); + ServiceInfo info = i.next(); synchronized (info) { @@ -1545,9 +1527,9 @@ public class JmDNS // Associate services to this, if they need announcing synchronized (JmDNS.this) { - for (Iterator s = services.values().iterator(); s.hasNext();) + for (Iterator<ServiceInfo> s = services.values().iterator(); s.hasNext();) { - ServiceInfo info = (ServiceInfo) s.next(); + ServiceInfo info = s.next(); if (info.getState() == DNSState.ANNOUNCING_1) { info.task = this; @@ -1617,14 +1599,14 @@ public class JmDNS // Defensively copy the services into a local list, // to prevent race conditions with methods registerService // and unregisterService. - List list; + List<ServiceInfo> list; synchronized (JmDNS.this) { - list = new ArrayList(services.values()); + list = new ArrayList<ServiceInfo>(services.values()); } - for (Iterator i = list.iterator(); i.hasNext();) + for (Iterator<ServiceInfo> i = list.iterator(); i.hasNext();) { - ServiceInfo info = (ServiceInfo) i.next(); + ServiceInfo info = i.next(); synchronized (info) { if (info.getState() == taskState && info.task == this) @@ -1716,9 +1698,9 @@ public class JmDNS // Associate services to this, if they need renewal synchronized (JmDNS.this) { - for (Iterator s = services.values().iterator(); s.hasNext();) + for (Iterator<ServiceInfo> s = services.values().iterator(); s.hasNext();) { - ServiceInfo info = (ServiceInfo) s.next(); + ServiceInfo info = s.next(); if (info.getState() == DNSState.ANNOUNCED) { info.task = this; @@ -1788,14 +1770,14 @@ public class JmDNS // Defensively copy the services into a local list, // to prevent race conditions with methods registerService // and unregisterService. - List list; + List<ServiceInfo> list; synchronized (JmDNS.this) { - list = new ArrayList(services.values()); + list = new ArrayList<ServiceInfo>(services.values()); } - for (Iterator i = list.iterator(); i.hasNext();) + for (Iterator<ServiceInfo> i = list.iterator(); i.hasNext();) { - ServiceInfo info = (ServiceInfo) i.next(); + ServiceInfo info = i.next(); synchronized (info) { if (info.getState() == taskState && info.task == this) @@ -1894,9 +1876,8 @@ public class JmDNS // We respond after 20-120 ms if the query is truncated. boolean iAmTheOnlyOne = true; - for (Iterator i = in.questions.iterator(); i.hasNext();) + for (DNSEntry entry : in.questions) { - DNSEntry entry = (DNSEntry) i.next(); if (entry instanceof DNSQuestion) { DNSQuestion q = (DNSQuestion) entry; @@ -1954,7 +1935,7 @@ public class JmDNS for (Iterator<DNSEntry> iterator = in.questions.iterator(); iterator.hasNext();) { - DNSEntry entry = (DNSEntry) iterator.next(); + DNSEntry entry = iterator.next(); if (entry instanceof DNSQuestion) { DNSQuestion q = (DNSQuestion) entry; @@ -2029,12 +2010,11 @@ public class JmDNS // Answer a query for services of a given type // find matching services - for (Iterator serviceIterator = + for (Iterator<ServiceInfo> serviceIterator = services.values().iterator(); serviceIterator.hasNext();) { - ServiceInfo info = - (ServiceInfo) serviceIterator.next(); + ServiceInfo info = serviceIterator.next(); if (info.getState() == DNSState.ANNOUNCED) { if (q.name.equalsIgnoreCase(info.type)) @@ -2089,7 +2069,7 @@ public class JmDNS DNSConstants.TYPE_PTR, DNSConstants.CLASS_IN, DNSConstants.DNS_TTL, - (String) serviceTypeIterator.next())); + serviceTypeIterator.next())); } } break; @@ -2098,8 +2078,7 @@ public class JmDNS case DNSConstants.TYPE_ANY: case DNSConstants.TYPE_TXT: { - ServiceInfo info = - (ServiceInfo) services.get(q.name.toLowerCase()); + ServiceInfo info = services.get(q.name.toLowerCase()); if (info != null && info.getState() == DNSState.ANNOUNCED) { @@ -2154,9 +2133,8 @@ public class JmDNS // remove known answers, if the ttl is at least half of // the correct value. (See Draft Cheshire chapter 7.1.). - for (Iterator i = in.answers.iterator(); i.hasNext();) + for (DNSRecord knownAnswer : in.answers) { - DNSRecord knownAnswer = (DNSRecord) i.next(); if (knownAnswer.ttl > DNSConstants.DNS_TTL / 2 && answers.remove(knownAnswer)) { @@ -2182,7 +2160,7 @@ public class JmDNS for (Iterator<DNSQuestion> i = questions.iterator(); i.hasNext();) { - out.addQuestion((DNSQuestion) i.next()); + out.addQuestion(i.next()); } for (Iterator<DNSRecord> i = answers.iterator(); i.hasNext();) @@ -2241,8 +2219,7 @@ public class JmDNS "_services._mdns._udp.local.", DNSConstants.TYPE_PTR, DNSConstants.CLASS_IN)); - for (Iterator iterator = serviceTypes.values().iterator(); - iterator.hasNext();) + for (String serviceType : serviceTypes.values()) { out.addAnswer( new DNSRecord.Pointer( @@ -2250,7 +2227,7 @@ public class JmDNS DNSConstants.TYPE_PTR, DNSConstants.CLASS_IN, DNSConstants.DNS_TTL, - (String) iterator.next()), 0); + serviceType), 0); } send(out); } @@ -2321,9 +2298,9 @@ public class JmDNS type, DNSConstants.TYPE_PTR, DNSConstants.CLASS_IN)); - for (Iterator s = services.values().iterator(); s.hasNext();) + for (Iterator<ServiceInfo> s = services.values().iterator(); s.hasNext();) { - final ServiceInfo info = (ServiceInfo) s.next(); + final ServiceInfo info = s.next(); try { out.addAnswer( @@ -2517,10 +2494,9 @@ public class JmDNS this.lock = lock; } - public Canceler(Collection infos, Object lock) + public Canceler(Collection<ServiceInfo> infos, Object lock) { - this.infos = - (ServiceInfo[]) infos.toArray(new ServiceInfo[infos.size()]); + this.infos = infos.toArray(new ServiceInfo[infos.size()]); this.lock = lock; } @@ -2618,7 +2594,7 @@ public class JmDNS state = DNSState.CANCELED; // This protects against recursive calls // We need to keep a copy for reregistration - Collection oldServiceInfos = new ArrayList(services.values()); + Collection<ServiceInfo> oldServiceInfos = new ArrayList<ServiceInfo>(services.values()); // Cancel all services unregisterAllServices(); @@ -2697,20 +2673,20 @@ public class JmDNS aLog.append("\t---- Services -----"); if (services != null) { - for (Iterator k = services.keySet().iterator(); k.hasNext();) + for (Map.Entry<String, ServiceInfo> entry : services.entrySet()) { - Object key = k.next(); - aLog.append("\n\t\tService: " + key + ": " + services.get(key)); + aLog.append("\n\t\tService: " + entry.getKey() + ": " + + entry.getValue()); } } aLog.append("\n"); aLog.append("\t---- Types ----"); if (serviceTypes != null) { - for (Iterator k = serviceTypes.keySet().iterator(); k.hasNext();) + for (Map.Entry<String, String> entry : serviceTypes.entrySet()) { - Object key = k.next(); - aLog.append("\n\t\tType: " + key + ": " + serviceTypes.get(key)); + aLog.append("\n\t\tType: " + entry.getKey() + ": " + + entry.getValue()); } } aLog.append("\n"); @@ -2721,11 +2697,11 @@ public class JmDNS { synchronized (serviceCollectors) { - for (Iterator k = serviceCollectors.keySet().iterator(); k.hasNext();) + for (Map.Entry<String, ServiceCollector> entry + : serviceCollectors.entrySet()) { - Object key = k.next(); - aLog.append("\n\t\tService Collector: " + key + ": " + - serviceCollectors.get(key)); + aLog.append("\n\t\tService Collector: " + entry.getKey() + + ": " + entry.getValue()); } serviceCollectors.clear(); } @@ -2754,7 +2730,7 @@ public class JmDNS boolean newCollectorCreated; synchronized (serviceCollectors) { - collector = (ServiceCollector) serviceCollectors.get(type); + collector = serviceCollectors.get(type); if (collector == null) { collector = new ServiceCollector(type); @@ -2796,9 +2772,9 @@ public class JmDNS logger.debug("disposeServiceCollectors()"); synchronized (serviceCollectors) { - for (Iterator i = serviceCollectors.values().iterator(); i.hasNext();) + for (Iterator<ServiceCollector> i = serviceCollectors.values().iterator(); i.hasNext();) { - ServiceCollector collector = (ServiceCollector) i.next(); + ServiceCollector collector = i.next(); removeServiceListener(collector.type, collector); } serviceCollectors.clear(); @@ -2817,7 +2793,7 @@ public class JmDNS /** * A set of collected service instance names. */ - private Map infos = Collections.synchronizedMap(new HashMap()); + private Map<String, ServiceInfo> infos = Collections.synchronizedMap(new HashMap<String, ServiceInfo>()); public String type; @@ -2870,7 +2846,7 @@ public class JmDNS { synchronized (infos) { - return (ServiceInfo[]) infos.values(). + return infos.values(). toArray(new ServiceInfo[infos.size()]); } } @@ -2880,10 +2856,10 @@ public class JmDNS StringBuffer aLog = new StringBuffer(); synchronized (infos) { - for (Iterator k = infos.keySet().iterator(); k.hasNext();) + for (Map.Entry<String, ServiceInfo> entry : infos.entrySet()) { - Object key = k.next(); - aLog.append("\n\t\tService: " + key + ": " + infos.get(key)); + aLog.append("\n\t\tService: " + entry.getKey() + ": " + + entry.getValue()); } } return aLog.toString(); @@ -3001,6 +2977,6 @@ public class JmDNS */ public ServiceInfo getLocalService(String FQN) { - return (ServiceInfo)services.get(FQN); + return services.get(FQN); } } diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/ServiceInfo.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/ServiceInfo.java index 7523916..eea0022 100644 --- a/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/ServiceInfo.java +++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/ServiceInfo.java @@ -46,7 +46,7 @@ public class ServiceInfo implements DNSListener int weight; int priority; byte text[]; - Hashtable props; + private Map<String, Object> props; InetAddress addr; @@ -107,7 +107,7 @@ public class ServiceInfo implements DNSListener */ public ServiceInfo(String type, String name, int port, int weight, - int priority, Hashtable props) + int priority, Map<String, Object> props) { this(type, name, port, weight, priority, new byte[0]); if (props != null) @@ -115,10 +115,10 @@ public class ServiceInfo implements DNSListener try { ByteArrayOutputStream out = new ByteArrayOutputStream(256); - for (Enumeration e = props.keys(); e.hasMoreElements();) + for (Map.Entry<String, Object> prop : props.entrySet()) { - String key = (String) e.nextElement(); - Object val = props.get(key); + String key = prop.getKey(); + Object val = prop.getValue(); ByteArrayOutputStream out2 = new ByteArrayOutputStream(100); writeUTF(out2, key); if (val instanceof String) @@ -413,13 +413,15 @@ public class ServiceInfo implements DNSListener } /** - * Enumeration of the property names. - * @return Enumeration of the property names. + * Iterator<String> of the property names. + * @return Iterator<String> of the property names. */ - public Enumeration getPropertyNames() + public Iterator<String> getPropertyNames() { - Hashtable props = getProperties(); - return (props != null) ? props.keys() : new Vector().elements(); + Map<String, Object> properties = getProperties(); + Iterable<String> propertyNames + = (properties != null) ? properties.keySet() : new Vector<String>(); + return propertyNames.iterator(); } /** @@ -505,11 +507,11 @@ public class ServiceInfo implements DNSListener return buf.toString(); } - synchronized Hashtable getProperties() + synchronized Map<String, Object> getProperties() { if ((props == null) && (text != null)) { - Hashtable props = new Hashtable(); + Map<String, Object> props = new Hashtable<String, Object>(); int off = 0; while (off < text.length) { @@ -715,17 +717,17 @@ public class ServiceInfo implements DNSListener * (for example in case of a status change). * @param props Hashtable containing all the new properties to set */ - public void setProps(Hashtable props) + public void setProps(Map<String, Object> props) { if (props != null) { try { ByteArrayOutputStream out = new ByteArrayOutputStream(256); - for (Enumeration e = props.keys(); e.hasMoreElements();) + for (Map.Entry<String, Object> prop : props.entrySet()) { - String key = (String) e.nextElement(); - Object val = props.get(key); + String key = prop.getKey(); + Object val = prop.getValue(); ByteArrayOutputStream out2 = new ByteArrayOutputStream(100); writeUTF(out2, key); diff --git a/src/net/java/sip/communicator/plugin/autoaway/AutoAwayConfigurationPanel.java b/src/net/java/sip/communicator/plugin/autoaway/AutoAwayConfigurationPanel.java index f025aab..aa081f9 100644 --- a/src/net/java/sip/communicator/plugin/autoaway/AutoAwayConfigurationPanel.java +++ b/src/net/java/sip/communicator/plugin/autoaway/AutoAwayConfigurationPanel.java @@ -114,7 +114,7 @@ public class AutoAwayConfigurationPanel this.timer.setEnabled(false); } - String t = (String) configService.getString(Preferences.TIMER); + String t = configService.getString(Preferences.TIMER); if (t != null) { try diff --git a/src/net/java/sip/communicator/plugin/autoaway/StatusUpdateThread.java b/src/net/java/sip/communicator/plugin/autoaway/StatusUpdateThread.java index b2c3f1c..6c417aa 100644 --- a/src/net/java/sip/communicator/plugin/autoaway/StatusUpdateThread.java +++ b/src/net/java/sip/communicator/plugin/autoaway/StatusUpdateThread.java @@ -194,7 +194,7 @@ public class StatusUpdateThread return 0;
}
- String t = (String) configService.getString(Preferences.TIMER);
+ String t = configService.getString(Preferences.TIMER);
int timer = 0;
try
{
diff --git a/src/net/java/sip/communicator/plugin/callhistoryform/ExtendedCallHistorySearchDialog.java b/src/net/java/sip/communicator/plugin/callhistoryform/ExtendedCallHistorySearchDialog.java index 0d5d88a..3b0d4e2 100644 --- a/src/net/java/sip/communicator/plugin/callhistoryform/ExtendedCallHistorySearchDialog.java +++ b/src/net/java/sip/communicator/plugin/callhistoryform/ExtendedCallHistorySearchDialog.java @@ -411,7 +411,7 @@ public class ExtendedCallHistorySearchDialog { addMe = true; - CallRecord callRecord = (CallRecord) lastCalls.next(); + CallRecord callRecord = lastCalls.next(); /* DATE Checking */ Date callStartDate = callRecord.getStartTime(); diff --git a/src/net/java/sip/communicator/plugin/defaultresourcepack/DefaultResourcePackActivator.java b/src/net/java/sip/communicator/plugin/defaultresourcepack/DefaultResourcePackActivator.java index 5944d09..4affd6b 100644 --- a/src/net/java/sip/communicator/plugin/defaultresourcepack/DefaultResourcePackActivator.java +++ b/src/net/java/sip/communicator/plugin/defaultresourcepack/DefaultResourcePackActivator.java @@ -37,7 +37,7 @@ public class DefaultResourcePackActivator DefaultColorPackImpl colPackImpl = new DefaultColorPackImpl(); - Hashtable props = new Hashtable(); + Hashtable<String, String> props = new Hashtable<String, String>(); props.put(ResourcePack.RESOURCE_NAME, ColorPack.RESOURCE_NAME_DEFAULT_VALUE); @@ -48,7 +48,7 @@ public class DefaultResourcePackActivator DefaultImagePackImpl imgPackImpl = new DefaultImagePackImpl(); - Hashtable imgProps = new Hashtable(); + Hashtable<String, String> imgProps = new Hashtable<String, String>(); imgProps.put(ResourcePack.RESOURCE_NAME, ImagePack.RESOURCE_NAME_DEFAULT_VALUE); @@ -59,7 +59,7 @@ public class DefaultResourcePackActivator DefaultLanguagePackImpl langPackImpl = new DefaultLanguagePackImpl(); - Hashtable langProps = new Hashtable(); + Hashtable<String, String> langProps = new Hashtable<String, String>(); langProps.put(ResourcePack.RESOURCE_NAME, LanguagePack.RESOURCE_NAME_DEFAULT_VALUE); @@ -70,7 +70,7 @@ public class DefaultResourcePackActivator DefaultSettingsPackImpl setPackImpl = new DefaultSettingsPackImpl(); - Hashtable setProps = new Hashtable(); + Hashtable<String, String> setProps = new Hashtable<String, String>(); langProps.put(ResourcePack.RESOURCE_NAME, SettingsPack.RESOURCE_NAME_DEFAULT_VALUE); @@ -81,7 +81,7 @@ public class DefaultResourcePackActivator DefaultSoundPackImpl sndPackImpl = new DefaultSoundPackImpl(); - Hashtable sndProps = new Hashtable(); + Hashtable<String, String> sndProps = new Hashtable<String, String>(); langProps.put(ResourcePack.RESOURCE_NAME, SoundPack.RESOURCE_NAME_DEFAULT_VALUE); diff --git a/src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java index 1cdf755..ae000c1 100644 --- a/src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java +++ b/src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java @@ -315,7 +315,7 @@ public class FirstWizardPage public void loadAccount(ProtocolProviderService protocolProvider)
{
AccountID accountID = protocolProvider.getAccountID();
- String password = (String) accountID.getAccountProperties()
+ String password = accountID.getAccountProperties()
.get(ProtocolProviderFactory.PASSWORD);
this.emailField.setEnabled(false);
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberServerChooserDialog.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberServerChooserDialog.java index b6efedc..7a5c143 100644 --- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberServerChooserDialog.java +++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberServerChooserDialog.java @@ -67,7 +67,7 @@ public class JabberServerChooserDialog private JButton cancelButton = new JButton(Resources .getString("cancelLabel")); - private Vector servers = new Vector(); + private Vector<String> servers = new Vector<String>(); private FileAccessService faService = null; diff --git a/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationPanel.java b/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationPanel.java index df6a10a..a094cb6 100644 --- a/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationPanel.java +++ b/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationPanel.java @@ -40,7 +40,7 @@ public class NotificationConfigurationPanel = Logger.getLogger(NotificationConfigurationPanel.class); // Declaration of variables on the table notifications - private Vector dataVector = null; + private Vector<NotificationsTableEntry> dataVector = null; private ListMulti notificationList; @@ -113,10 +113,7 @@ public class NotificationConfigurationPanel { "Status", icon1, icon2, icon3, "Event" }; notificationList = new ListMulti(column, columnToolTips); - dataVector = new Vector(); - //dataVector.add(row1); - //dataVector.add(row2); - //dataVector.add(row3); + dataVector = new Vector<NotificationsTableEntry>(); gridLayoutGlobal.setConstraints(notificationList, constraints); this.add(notificationList); @@ -361,8 +358,7 @@ public class NotificationConfigurationPanel if(dataVector.size() > 0) { - NotificationsTableEntry tmpNTE - = (NotificationsTableEntry) dataVector.elementAt(0); + NotificationsTableEntry tmpNTE = dataVector.elementAt(0); updatePanel(tmpNTE); notificationList.setRowSelectionInterval(0,0); @@ -392,8 +388,7 @@ public class NotificationConfigurationPanel { if(e.getSource() == activate) { - NotificationsTableEntry tmpNTE - = (NotificationsTableEntry) dataVector.elementAt(index); + NotificationsTableEntry tmpNTE = dataVector.elementAt(index); tmpNTE.setEnabled(true); this.updateTableRow(tmpNTE, index); activate.setEnabled(false); @@ -402,8 +397,7 @@ public class NotificationConfigurationPanel } else if(e.getSource() == deactivate) { - NotificationsTableEntry tmpNTE - = (NotificationsTableEntry) dataVector.elementAt(index); + NotificationsTableEntry tmpNTE = dataVector.elementAt(index); tmpNTE.setEnabled(false); this.updateTableRow(tmpNTE, index); activate.setEnabled(true); @@ -419,8 +413,7 @@ public class NotificationConfigurationPanel { try { - NotificationsTableEntry tmpNTE - = (NotificationsTableEntry) dataVector.elementAt(index); + NotificationsTableEntry tmpNTE = dataVector.elementAt(index); File file = fileChooserSound.getSelectedFile(); //This is where a real application would open the file. logger.debug("Opening: " @@ -451,8 +444,7 @@ public class NotificationConfigurationPanel if (returnVal == JFileChooser.APPROVE_OPTION) { - NotificationsTableEntry tmpNTE - = (NotificationsTableEntry)dataVector.elementAt(index); + NotificationsTableEntry tmpNTE = dataVector.elementAt(index); File file = fileChooserProgram.getSelectedFile(); //This is where a real application would open the file. logger.debug("Opening: " +file.getAbsolutePath()); @@ -497,7 +489,7 @@ public class NotificationConfigurationPanel } else if(e.getSource() == turnOnAll) { - Iterator it = dataVector.iterator(); + Iterator<NotificationsTableEntry> it = dataVector.iterator(); NotificationsTableEntry tmpNTE = null; int cpt = 0; @@ -507,7 +499,7 @@ public class NotificationConfigurationPanel turnAll = true; while(it.hasNext()) { - tmpNTE = (NotificationsTableEntry)it.next(); + tmpNTE = it.next(); if(((String)comboBoxTurnOn.getSelectedItem()).equals("Sounds")) { if(tmpNTE.getSoundFile().trim().length() != 0) @@ -535,7 +527,7 @@ public class NotificationConfigurationPanel cpt ++; } notificationList.setRowSelectionInterval(index, index); - tmpNTE = (NotificationsTableEntry) dataVector.elementAt(index); + tmpNTE = dataVector.elementAt(index); if(((String)comboBoxTurnOn.getSelectedItem()).equals("Sounds")) { playSoundCheckBox.setSelected(tmpNTE.getSound()); @@ -554,7 +546,7 @@ public class NotificationConfigurationPanel } else if(e.getSource() == turnOffAll) { - Iterator it = dataVector.iterator(); + Iterator<NotificationsTableEntry> it = dataVector.iterator(); NotificationsTableEntry tmpNTE = null; int cpt = 0; @@ -564,7 +556,7 @@ public class NotificationConfigurationPanel turnAll = true; while(it.hasNext()) { - tmpNTE = (NotificationsTableEntry)it.next(); + tmpNTE = it.next(); if(((String)comboBoxTurnOff.getSelectedItem()).equals("Sounds")) { tmpNTE.setSound(false); @@ -586,7 +578,7 @@ public class NotificationConfigurationPanel cpt ++; } notificationList.setRowSelectionInterval(index, index); - tmpNTE = (NotificationsTableEntry) dataVector.elementAt(index); + tmpNTE = dataVector.elementAt(index); if(((String)comboBoxTurnOn.getSelectedItem()).equals("Sounds")) { playSoundCheckBox.setSelected(tmpNTE.getSound()); @@ -605,11 +597,11 @@ public class NotificationConfigurationPanel } else if(e.getSource() == apply) { - Iterator it = dataVector.iterator(); + Iterator<NotificationsTableEntry> it = dataVector.iterator(); NotificationsTableEntry tmpNTE = null; while(it.hasNext()) { - tmpNTE = (NotificationsTableEntry) it.next(); + tmpNTE = it.next(); if(tmpNTE.isModified()) { @@ -679,8 +671,7 @@ public class NotificationConfigurationPanel if(ix >= 0) { - NotificationsTableEntry tmpNTE - = (NotificationsTableEntry) dataVector.elementAt(ix); + NotificationsTableEntry tmpNTE = dataVector.elementAt(ix); updatePanel(tmpNTE); } } @@ -693,8 +684,7 @@ public class NotificationConfigurationPanel { if(index == -1 || noListener == true) return; - NotificationsTableEntry tmpNTE - = (NotificationsTableEntry) dataVector.elementAt(index); + NotificationsTableEntry tmpNTE = dataVector.elementAt(index); if(itev.getSource() == playSoundCheckBox) { if(playSoundCheckBox.isSelected()) @@ -752,8 +742,7 @@ public class NotificationConfigurationPanel { if(index != -1 && noListener == false) { - NotificationsTableEntry tmpNTE - = (NotificationsTableEntry) dataVector.elementAt(index); + NotificationsTableEntry tmpNTE = dataVector.elementAt(index); if(de.getDocument().equals(programFileTextField.getDocument())) { tmpNTE.setProgramFile(programFileTextField.getText()); @@ -774,8 +763,7 @@ public class NotificationConfigurationPanel { if(index != -1 && noListener == false) { - NotificationsTableEntry tmpNTE - = (NotificationsTableEntry) dataVector.elementAt(index); + NotificationsTableEntry tmpNTE = dataVector.elementAt(index); if(de.getDocument().equals(programFileTextField.getDocument())) { tmpNTE.setProgramFile(programFileTextField.getText()); @@ -797,8 +785,8 @@ public class NotificationConfigurationPanel public void actionAdded(NotificationActionTypeEvent event) { logger.debug("Start action added"); - String eventName = (String) event.getSourceEventType(); - Iterator it = null; + String eventName = event.getSourceEventType(); + Iterator<NotificationsTableEntry> it = null; int row = 0; NotificationsTableEntry tmpNTE = null; @@ -845,7 +833,7 @@ public class NotificationConfigurationPanel it = dataVector.iterator(); while(it.hasNext()) { - tmpNTE = (NotificationsTableEntry)it.next(); + tmpNTE = it.next(); if(tmpNTE.getEvent().equals(eventName)) { if(event.getSourceActionType() @@ -916,8 +904,8 @@ public class NotificationConfigurationPanel public void actionRemoved(NotificationActionTypeEvent event) { logger.debug("Start action remove"); - String eventName = (String) event.getSourceEventType(); - Iterator it = null; + String eventName = event.getSourceEventType(); + Iterator<NotificationsTableEntry> it = null; NotificationsTableEntry tmpNTE = null; if(dataVector.size() == 0) return; @@ -925,7 +913,7 @@ public class NotificationConfigurationPanel it = dataVector.iterator(); while(it.hasNext()) { - tmpNTE = (NotificationsTableEntry) it.next(); + tmpNTE = it.next(); if(tmpNTE.getEvent().equals(eventName)) { if(event.getSourceActionType() @@ -954,15 +942,15 @@ public class NotificationConfigurationPanel public void actionChanged(NotificationActionTypeEvent event) { logger.debug("Start action changed"); - String eventName = (String) event.getSourceEventType(); - Iterator it = null; + String eventName = event.getSourceEventType(); + Iterator<NotificationsTableEntry> it = null; int row = 0; NotificationsTableEntry tmpNTE = null; it = dataVector.iterator(); while(it.hasNext()) { - tmpNTE = (NotificationsTableEntry)it.next(); + tmpNTE = it.next(); if(tmpNTE.getEvent().equals(eventName)) { if(event.getSourceActionType() @@ -987,12 +975,12 @@ public class NotificationConfigurationPanel public void eventTypeAdded(NotificationEventTypeEvent event) { - String eventAdded = (String) event.getSourceEventType(); - Iterator it = dataVector.iterator(); + String eventAdded = event.getSourceEventType(); + Iterator<NotificationsTableEntry> it = dataVector.iterator(); NotificationsTableEntry tmpNTE = null; while(it.hasNext()) { - tmpNTE = (NotificationsTableEntry) it.next(); + tmpNTE = it.next(); if(tmpNTE.getEvent().equals(eventAdded)) return; } @@ -1004,7 +992,7 @@ public class NotificationConfigurationPanel public void eventTypeRemoved(NotificationEventTypeEvent event) { - Iterator it = null; + Iterator<NotificationsTableEntry> it = null; NotificationsTableEntry tmpNTE = null; int row = 0; @@ -1013,7 +1001,7 @@ public class NotificationConfigurationPanel it = dataVector.iterator(); while(it.hasNext()) { - tmpNTE = (NotificationsTableEntry) it.next(); + tmpNTE = it.next(); if(tmpNTE.getEvent().equals(event.getSourceEventType())) { dataVector.remove(row); @@ -1027,7 +1015,7 @@ public class NotificationConfigurationPanel public void updateTable() { - Iterator it = dataVector.iterator(); + Iterator<NotificationsTableEntry> it = dataVector.iterator(); NotificationsTableEntry tmpNTE = null; int i = 0; int cpt = notificationList.getRowCount(); @@ -1062,7 +1050,7 @@ public class NotificationConfigurationPanel while(it.hasNext()) { - tmpNTE = (NotificationsTableEntry) it.next(); + tmpNTE = it.next(); notificationList.addLine(tmpNTE); } } @@ -1160,8 +1148,7 @@ public class NotificationConfigurationPanel if(index != -1) { - NotificationsTableEntry tmpNTE - = (NotificationsTableEntry) dataVector.elementAt(index); + NotificationsTableEntry tmpNTE = dataVector.elementAt(index); activate.setEnabled(!tmpNTE.getEnabled()); deactivate.setEnabled(tmpNTE.getEnabled()); if(tmpNTE.getProgram() diff --git a/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardActivator.java b/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardActivator.java index 1a25ded..0079077 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardActivator.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardActivator.java @@ -84,7 +84,7 @@ public class WhiteboardActivator implements BundleActivator */ public static List getWhiteboardOperationSets() { - List whiteboardOpSets = new ArrayList(); + List<OperationSet> whiteboardOpSets = new ArrayList<OperationSet>(); ServiceReference[] serRefs = null; try @@ -118,4 +118,4 @@ public class WhiteboardActivator implements BundleActivator return whiteboardOpSets; } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardSessionManager.java b/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardSessionManager.java index 21f60ee..775f3b7 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardSessionManager.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardSessionManager.java @@ -462,7 +462,7 @@ public class WhiteboardSessionManager for(int i =0; i < wbFrames.size (); i++) { - whiteboardFrame = (WhiteboardFrame) wbFrames.get (i); + whiteboardFrame = wbFrames.get (i); if (whiteboardFrame.getContact() != null && whiteboardFrame.getContact().equals (contact)) @@ -654,4 +654,4 @@ public class WhiteboardSessionManager wbFrames.remove(frame); } } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/service/protocol/AbstractCallPeer.java b/src/net/java/sip/communicator/service/protocol/AbstractCallPeer.java index a298ecc..6501ed8 100644 --- a/src/net/java/sip/communicator/service/protocol/AbstractCallPeer.java +++ b/src/net/java/sip/communicator/service/protocol/AbstractCallPeer.java @@ -197,8 +197,7 @@ public abstract class AbstractCallPeer while (listeners.hasNext()) { - CallPeerListener listener - = (CallPeerListener) listeners.next(); + CallPeerListener listener = listeners.next(); if(eventType.equals(CallPeerChangeEvent .CALL_PEER_ADDRESS_CHANGE)) @@ -254,8 +253,7 @@ public abstract class AbstractCallPeer while (listeners.hasNext()) { - CallPeerSecurityListener listener - = (CallPeerSecurityListener) listeners.next(); + CallPeerSecurityListener listener = listeners.next(); listener.securityOn(evt); } @@ -288,8 +286,7 @@ public abstract class AbstractCallPeer while (listeners.hasNext()) { - CallPeerSecurityListener listener - = (CallPeerSecurityListener) listeners.next(); + CallPeerSecurityListener listener = listeners.next(); listener.securityOff(event); } @@ -327,8 +324,7 @@ public abstract class AbstractCallPeer while (listeners.hasNext()) { - CallPeerSecurityListener listener - = (CallPeerSecurityListener) listeners.next(); + CallPeerSecurityListener listener = listeners.next(); listener.securityMessageRecieved(evt); } diff --git a/src/net/java/sip/communicator/service/protocol/AbstractOperationSetBasicInstantMessaging.java b/src/net/java/sip/communicator/service/protocol/AbstractOperationSetBasicInstantMessaging.java index f82037a..b6979ac 100644 --- a/src/net/java/sip/communicator/service/protocol/AbstractOperationSetBasicInstantMessaging.java +++ b/src/net/java/sip/communicator/service/protocol/AbstractOperationSetBasicInstantMessaging.java @@ -250,28 +250,36 @@ public abstract class AbstractOperationSetBasicInstantMessaging if (opSetMessageTransform == null) return evt; - for (Map.Entry<Integer, Vector<TransformLayer>> entry : opSetMessageTransform.transformLayers - .entrySet()) + for (Map.Entry<Integer, Vector<TransformLayer>> entry + : opSetMessageTransform.transformLayers.entrySet()) { - for (Iterator<TransformLayer> iterator = entry.getValue().iterator(); iterator - .hasNext();) + for (TransformLayer transformLayer : entry.getValue()) { - TransformLayer transformLayer = (TransformLayer) iterator.next(); if (evt != null){ - switch (eventType){ - case MessageDelivered: - evt = transformLayer.messageDelivered((MessageDeliveredEvent)evt); - break; - case MessageDeliveryPending: - evt = transformLayer.messageDeliveryPending((MessageDeliveredEvent)evt); - break; - case MessageDeliveryFailed: - evt = transformLayer.messageDeliveryFailed((MessageDeliveryFailedEvent)evt); - break; - case MessageReceived: - evt = transformLayer.messageReceived((MessageReceivedEvent)evt); - break; - } + switch (eventType){ + case MessageDelivered: + evt + = transformLayer + .messageDelivered((MessageDeliveredEvent)evt); + break; + case MessageDeliveryPending: + evt + = transformLayer + .messageDeliveryPending( + (MessageDeliveredEvent)evt); + break; + case MessageDeliveryFailed: + evt + = transformLayer + .messageDeliveryFailed( + (MessageDeliveryFailedEvent)evt); + break; + case MessageReceived: + evt + = transformLayer + .messageReceived((MessageReceivedEvent)evt); + break; + } } } } diff --git a/src/net/java/sip/communicator/service/protocol/AccountID.java b/src/net/java/sip/communicator/service/protocol/AccountID.java index a41202d..97f8f51 100644 --- a/src/net/java/sip/communicator/service/protocol/AccountID.java +++ b/src/net/java/sip/communicator/service/protocol/AccountID.java @@ -56,10 +56,10 @@ public abstract class AccountID * @return */ private static final String getOverriddenProtocolName( - Map accountProperties, String defaultProtocolName) + Map<String, String> accountProperties, String defaultProtocolName) { String key = ProtocolProviderFactory.PROTOCOL; - String protocolName = (String) accountProperties.get(key); + String protocolName = accountProperties.get(key); if ((protocolName == null) && (defaultProtocolName != null)) { protocolName = defaultProtocolName; @@ -76,7 +76,7 @@ public abstract class AccountID * If you need something else, please consider converting it through custom * accessors (get/set) in your implementation. */ - protected Map accountProperties = null; + protected Map<String, String> accountProperties = null; /** * A String uniquely identifying the user for this particular account. @@ -106,7 +106,7 @@ public abstract class AccountID * icq.com) that this account is registered with. */ protected AccountID( String userID, - Map accountProperties, + Map<String, String> accountProperties, String protocolName, String serviceName) { @@ -120,7 +120,7 @@ public abstract class AccountID protocolName = getOverriddenProtocolName(accountProperties, protocolName); this.userID = userID; - this.accountProperties = new Hashtable(accountProperties); + this.accountProperties = new Hashtable<String, String>(accountProperties); this.serviceName = serviceName; //create a unique identifier string @@ -173,9 +173,9 @@ public abstract class AccountID * @return a Map containing protocol and implementation account * initialization properties. */ - public Map getAccountProperties() + public Map<String, String> getAccountProperties() { - return new Hashtable(accountProperties); + return new Hashtable<String, String>(accountProperties); } public Object getAccountProperty(Object key) @@ -221,7 +221,7 @@ public abstract class AccountID * @param key the key of the property * @param value the property value */ - public void putAccountProperty(Object key, Object value) + public void putAccountProperty(String key, String value) { accountProperties.put(key, value); } @@ -308,7 +308,7 @@ public abstract class AccountID * * @param accountProperties the properties of the account */ - public void setAccountProperties(Map accountProperties) + public void setAccountProperties(Map<String, String> accountProperties) { this.accountProperties = accountProperties; } diff --git a/src/net/java/sip/communicator/service/protocol/OperationSetGeolocation.java b/src/net/java/sip/communicator/service/protocol/OperationSetGeolocation.java index a220f15..df9e783 100644 --- a/src/net/java/sip/communicator/service/protocol/OperationSetGeolocation.java +++ b/src/net/java/sip/communicator/service/protocol/OperationSetGeolocation.java @@ -145,7 +145,7 @@ public interface OperationSetGeolocation * @param geolocation a <tt>java.uil.Map</tt> containing the geolocation * details of the position we'd like to publish. */ - public void publishGeolocation(Map geolocation); + public void publishGeolocation(Map<String, String> geolocation); /** * Retrieve the geolocation of the contact corresponding to @@ -157,7 +157,7 @@ public interface OperationSetGeolocation * @return a <tt>java.util.Map</tt> containing the geolocation details of * the contact with address <tt>contactIdentifier</tt>. */ - public Map queryContactGeolocation(String contactIdentifier); + public Map<String, String> queryContactGeolocation(String contactIdentifier); /** * Registers a listener that would get notifications any time a contact diff --git a/src/net/java/sip/communicator/service/protocol/msnconstants/MsnStatusEnum.java b/src/net/java/sip/communicator/service/protocol/msnconstants/MsnStatusEnum.java index d3532f8..45d535e 100644 --- a/src/net/java/sip/communicator/service/protocol/msnconstants/MsnStatusEnum.java +++ b/src/net/java/sip/communicator/service/protocol/msnconstants/MsnStatusEnum.java @@ -103,7 +103,8 @@ public class MsnStatusEnum /** * The minimal set of states that any implementation must support. */ - public static final ArrayList msnStatusSet =new ArrayList(); + public static final ArrayList<MsnStatusEnum> msnStatusSet + = new ArrayList<MsnStatusEnum>(); static{ msnStatusSet.add(OUT_TO_LUNCH); msnStatusSet.add(ON_THE_PHONE); diff --git a/src/net/java/sip/communicator/service/protocol/yahooconstants/YahooStatusEnum.java b/src/net/java/sip/communicator/service/protocol/yahooconstants/YahooStatusEnum.java index 8e6ae56..eda1d04 100644 --- a/src/net/java/sip/communicator/service/protocol/yahooconstants/YahooStatusEnum.java +++ b/src/net/java/sip/communicator/service/protocol/yahooconstants/YahooStatusEnum.java @@ -133,7 +133,8 @@ public class YahooStatusEnum /** * The minimal set of states that any implementation must support. */ - public static final ArrayList yahooStatusSet =new ArrayList(); + public static final ArrayList<YahooStatusEnum> yahooStatusSet + = new ArrayList<YahooStatusEnum>(); static{ yahooStatusSet.add(AVAILABLE); yahooStatusSet.add(BE_RIGHT_BACK); diff --git a/src/net/java/sip/communicator/util/swing/plaf/SIPCommTabbedPaneUI.java b/src/net/java/sip/communicator/util/swing/plaf/SIPCommTabbedPaneUI.java index a52fcd1..6113048 100644 --- a/src/net/java/sip/communicator/util/swing/plaf/SIPCommTabbedPaneUI.java +++ b/src/net/java/sip/communicator/util/swing/plaf/SIPCommTabbedPaneUI.java @@ -50,7 +50,7 @@ public class SIPCommTabbedPaneUI // Instance variables initialized at installation private ContainerListener containerListener; - private Vector htmlViews; + private Vector<View> htmlViews; private Map<Integer, Integer> mnemonicToIndexMap; @@ -1600,9 +1600,9 @@ public class SIPCommTabbedPaneUI } } - private Vector createHTMLVector() + private Vector<View> createHTMLVector() { - Vector htmlViews = new Vector(); + Vector<View> htmlViews = new Vector<View>(); int count = tabPane.getTabCount(); if (count > 0) { for (int i = 0; i < count; i++) |