diff options
author | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2014-09-30 22:40:08 +0300 |
---|---|---|
committer | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2014-09-30 22:40:44 +0300 |
commit | bcefab613f2cc088c0ff09d8d20e67ef2af86fe8 (patch) | |
tree | c7230cc2fcb86f9a13c5f700c3b929cd564fec4f /src/net/java/sip | |
parent | 5a03482109e2eab5cf3891cabbc77aa25e4dbfd2 (diff) | |
download | jitsi-bcefab613f2cc088c0ff09d8d20e67ef2af86fe8.zip jitsi-bcefab613f2cc088c0ff09d8d20e67ef2af86fe8.tar.gz jitsi-bcefab613f2cc088c0ff09d8d20e67ef2af86fe8.tar.bz2 |
Fixes warnings.
Diffstat (limited to 'src/net/java/sip')
12 files changed, 251 insertions, 245 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java index 22f03d1..b644234 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java @@ -1881,43 +1881,45 @@ public class ChatConversationPanel public static ConfigurationForm getChatConfigForm() { // General configuration forms only. - String osgiFilter = "(" - + ConfigurationForm.FORM_TYPE - + "="+ConfigurationForm.GENERAL_TYPE+")"; + Collection<ServiceReference<ConfigurationForm>> cfgFormRefs; + String osgiFilter + = "(" + ConfigurationForm.FORM_TYPE + "=" + + ConfigurationForm.GENERAL_TYPE + ")"; - ServiceReference[] confFormsRefs = null; try { - confFormsRefs = GuiActivator.bundleContext - .getServiceReferences( - ConfigurationForm.class.getName(), - osgiFilter); + cfgFormRefs + = GuiActivator.bundleContext.getServiceReferences( + ConfigurationForm.class, + osgiFilter); } catch (InvalidSyntaxException ex) - {} - - String chatConfigFormClassName = - "net.java.sip.communicator.plugin.chatconfig.ChatConfigPanel"; + { + cfgFormRefs = null; + } - if(confFormsRefs != null) + if ((cfgFormRefs != null) && !cfgFormRefs.isEmpty()) { - for (int i = 0; i < confFormsRefs.length; i++) + String chatCfgFormClassName + = "net.java.sip.communicator.plugin.chatconfig.ChatConfigPanel"; + + for (ServiceReference<ConfigurationForm> cfgFormRef : cfgFormRefs) { ConfigurationForm form - = (ConfigurationForm) GuiActivator.bundleContext - .getService(confFormsRefs[i]); + = GuiActivator.bundleContext.getService(cfgFormRef); if (form instanceof LazyConfigurationForm) { LazyConfigurationForm lazyConfigForm = (LazyConfigurationForm) form; - if (lazyConfigForm.getFormClassName() - .equals(chatConfigFormClassName)) + if (chatCfgFormClassName.equals( + lazyConfigForm.getFormClassName())) + { return form; + } } - else if (form.getClass().getName() - .equals(chatConfigFormClassName)) + else if (form.getClass().getName().equals(chatCfgFormClassName)) { return form; } diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java index ac0fea7..bca8692 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java @@ -811,48 +811,51 @@ public class ChatWindow // Search for plugin components registered through the OSGI bundle // context. - ServiceReference[] serRefs = null; - - String osgiFilter = "(|(" - + Container.CONTAINER_ID - + "="+Container.CONTAINER_CHAT_WINDOW.getID()+")" - + "(" + Container.CONTAINER_ID - + "="+Container.CONTAINER_CHAT_STATUS_BAR.getID()+"))"; + Collection<ServiceReference<PluginComponentFactory>> serRefs; + String osgiFilter + = "(|(" + Container.CONTAINER_ID + "=" + + Container.CONTAINER_CHAT_WINDOW.getID() + ")(" + + Container.CONTAINER_ID + "=" + + Container.CONTAINER_CHAT_STATUS_BAR.getID() + "))"; try { - serRefs = GuiActivator.bundleContext.getServiceReferences( - PluginComponentFactory.class.getName(), - osgiFilter); + serRefs + = GuiActivator.bundleContext.getServiceReferences( + PluginComponentFactory.class, + osgiFilter); } - catch (InvalidSyntaxException exc) + catch (InvalidSyntaxException ex) { - logger.error("Could not obtain plugin component reference.", exc); + serRefs = null; + logger.error("Could not obtain plugin component reference.", ex); } - if (serRefs != null) + if ((serRefs != null) && !serRefs.isEmpty()) { - for (ServiceReference serRef : serRefs) + for (ServiceReference<PluginComponentFactory> serRef : serRefs) { PluginComponentFactory factory - = (PluginComponentFactory) - GuiActivator .bundleContext.getService(serRef); - - Component comp = (Component)factory.getPluginComponentInstance( - ChatWindow.this).getComponent(); + = GuiActivator.bundleContext.getService(serRef); + Component comp + = (Component) + factory + .getPluginComponentInstance(ChatWindow.this) + .getComponent(); // If this component has been already added, we have nothing // more to do here. if (comp.getParent() != null) return; - Object borderLayoutConstraint = UIServiceImpl - .getBorderLayoutConstraintsFromContainer( - factory.getConstraints()); + Object borderLayoutConstraints + = UIServiceImpl.getBorderLayoutConstraintsFromContainer( + factory.getConstraints()); - this.addPluginComponent(comp, - factory.getContainer(), - borderLayoutConstraint); + addPluginComponent( + comp, + factory.getContainer(), + borderLayoutConstraints); } } } diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java index 7c8b480..0fe3a88 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java @@ -1593,49 +1593,56 @@ public class ChatWritePanel { // Search for plugin components registered through the OSGI bundle // context. - ServiceReference[] serRefs = null; - - String osgiFilter = "(" - + net.java.sip.communicator.service.gui.Container.CONTAINER_ID - + "="+net.java.sip.communicator.service.gui.Container. - CONTAINER_CHAT_WRITE_PANEL.getID()+")"; + Collection<ServiceReference<PluginComponentFactory>> serRefs; + String osgiFilter + = "(" + net.java.sip.communicator.service.gui.Container.CONTAINER_ID + + "=" + + net.java.sip.communicator.service.gui.Container + .CONTAINER_CHAT_WRITE_PANEL.getID() + + ")"; try { - serRefs = GuiActivator.bundleContext.getServiceReferences( - PluginComponentFactory.class.getName(), - osgiFilter); + serRefs + = GuiActivator.bundleContext.getServiceReferences( + PluginComponentFactory.class, + osgiFilter); } - catch (InvalidSyntaxException exc) + catch (InvalidSyntaxException ex) { - logger.error("Could not obtain plugin reference.", exc); + serRefs = null; + logger.error("Could not obtain plugin reference.", ex); } - if (serRefs != null) + if ((serRefs != null) && !serRefs.isEmpty()) { - for (int i = 0; i < serRefs.length; i ++) + for (ServiceReference<PluginComponentFactory> serRef : serRefs) { - PluginComponentFactory factory = - (PluginComponentFactory) GuiActivator - .bundleContext.getService(serRefs[i]); - - PluginComponent component = - factory.getPluginComponentInstance(this); + PluginComponentFactory factory + = GuiActivator.bundleContext.getService(serRef); + PluginComponent component + = factory.getPluginComponentInstance(this); ChatSession chatSession = chatPanel.getChatSession(); + if (chatSession != null) { - ChatTransport currentTransport = - chatSession.getCurrentChatTransport(); + ChatTransport currentTransport + = chatSession.getCurrentChatTransport(); Object currentDescriptor = currentTransport.getDescriptor(); + if (currentDescriptor instanceof Contact) { Contact contact = (Contact) currentDescriptor; component.setCurrentContact( - contact, currentTransport.getResourceName()); + contact, + currentTransport.getResourceName()); } } - if (component.getComponent() == null) + + Object c = component.getComponent(); + + if (c == null) continue; GridBagConstraints constraints = new GridBagConstraints(); @@ -1648,8 +1655,7 @@ public class ChatWritePanel constraints.weighty = 0f; constraints.insets = new Insets(0, 3, 0, 0); - centerPanel.add( - (Component)component.getComponent(), constraints); + centerPanel.add((Component) c, constraints); } } GuiActivator.getUIService().addPluginComponentListener(this); diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/menus/HelpMenu.java b/src/net/java/sip/communicator/impl/gui/main/chat/menus/HelpMenu.java index b77c33a..7b09323 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/menus/HelpMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/menus/HelpMenu.java @@ -9,6 +9,7 @@ package net.java.sip.communicator.impl.gui.main.chat.menus; import java.awt.*; import java.awt.event.*; +import java.util.*; import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.event.*; @@ -69,34 +70,34 @@ public class HelpMenu { // Search for plugin components registered through the OSGI bundle // context. - ServiceReference[] serRefs = null; - - String osgiFilter = "(" - + Container.CONTAINER_ID - + "="+Container.CONTAINER_CHAT_HELP_MENU.getID()+")"; + Collection<ServiceReference<PluginComponentFactory>> serRefs; + String osgiFilter + = "(" + Container.CONTAINER_ID + "=" + + Container.CONTAINER_CHAT_HELP_MENU.getID() + ")"; try { - serRefs = GuiActivator.bundleContext.getServiceReferences( - PluginComponentFactory.class.getName(), - osgiFilter); + serRefs + = GuiActivator.bundleContext.getServiceReferences( + PluginComponentFactory.class, + osgiFilter); } - catch (InvalidSyntaxException exc) + catch (InvalidSyntaxException ex) { - logger.error("Could not obtain plugin reference.", exc); + serRefs = null; + logger.error("Could not obtain plugin reference.", ex); } - if (serRefs != null) + if ((serRefs != null) && !serRefs.isEmpty()) { - for (int i = 0; i < serRefs.length; i ++) + for (ServiceReference<PluginComponentFactory> serRef : serRefs) { - PluginComponentFactory factory = - (PluginComponentFactory) GuiActivator - .bundleContext.getService(serRefs[i]); - PluginComponent component = - factory.getPluginComponentInstance(HelpMenu.this); + PluginComponentFactory factory + = GuiActivator.bundleContext.getService(serRef); + PluginComponent component + = factory.getPluginComponentInstance(HelpMenu.this); - this.add((Component)component.getComponent()); + add((Component) component.getComponent()); } } diff --git a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/AdHocChatRoomList.java b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/AdHocChatRoomList.java index b4715d0..9f3075e 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/AdHocChatRoomList.java +++ b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/AdHocChatRoomList.java @@ -23,9 +23,6 @@ import org.osgi.framework.*; */ public class AdHocChatRoomList { - private static final Logger logger - = Logger.getLogger(AdHocChatRoomList.class); - /** * The list containing all chat servers and ad-hoc rooms. */ @@ -37,37 +34,25 @@ public class AdHocChatRoomList */ public void loadList() { - try - { - ServiceReference[] serRefs - = GuiActivator.bundleContext.getServiceReferences( - ProtocolProviderService.class.getName(), - null); - - // If we don't have providers at this stage we just return. - if (serRefs == null) - return; + Collection<ServiceReference<ProtocolProviderService>> serRefs + = ServiceUtils.getServiceReferences( + GuiActivator.bundleContext, + ProtocolProviderService.class); - for (ServiceReference serRef : serRefs) + if ((serRefs != null) && !serRefs.isEmpty()) + { + for (ServiceReference<ProtocolProviderService> serRef : serRefs) { ProtocolProviderService protocolProvider - = (ProtocolProviderService) - GuiActivator.bundleContext.getService(serRef); - + = GuiActivator.bundleContext.getService(serRef); Object adHocMultiUserChatOpSet - = protocolProvider - .getOperationSet(OperationSetAdHocMultiUserChat.class); + = protocolProvider.getOperationSet( + OperationSetAdHocMultiUserChat.class); if (adHocMultiUserChatOpSet != null) - { - this.addChatProvider(protocolProvider); - } + addChatProvider(protocolProvider); } } - catch (InvalidSyntaxException e) - { - logger.error("Failed to obtain service references.", e); - } } /** diff --git a/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigurationFrame.java b/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigurationFrame.java index 104382e..610042b 100644 --- a/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigurationFrame.java +++ b/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigurationFrame.java @@ -6,6 +6,7 @@ package net.java.sip.communicator.impl.gui.main.configforms; import java.awt.*; +import java.util.*; import javax.swing.*; import javax.swing.border.*; @@ -119,30 +120,31 @@ public class ConfigurationFrame GuiActivator.bundleContext.addServiceListener(this); // General configuration forms only. - String osgiFilter = "(" - + ConfigurationForm.FORM_TYPE - + "="+ConfigurationForm.GENERAL_TYPE+")"; + Collection<ServiceReference<ConfigurationForm>> cfgFormRefs; + String osgiFilter + = "(" + ConfigurationForm.FORM_TYPE + "=" + + ConfigurationForm.GENERAL_TYPE + ")"; - ServiceReference[] confFormsRefs = null; try { - confFormsRefs = GuiActivator.bundleContext - .getServiceReferences( - ConfigurationForm.class.getName(), - osgiFilter); + cfgFormRefs + = GuiActivator.bundleContext.getServiceReferences( + ConfigurationForm.class, + osgiFilter); } catch (InvalidSyntaxException ex) - {} + { + cfgFormRefs = null; + } - if(confFormsRefs != null) + if ((cfgFormRefs != null) && !cfgFormRefs.isEmpty()) { - for (int i = 0; i < confFormsRefs.length; i++) + for (ServiceReference<ConfigurationForm> cfgFormRef : cfgFormRefs) { ConfigurationForm form - = (ConfigurationForm) GuiActivator.bundleContext - .getService(confFormsRefs[i]); + = GuiActivator.bundleContext.getService(cfgFormRef); - this.addConfigurationForm(form); + addConfigurationForm(form); } } } @@ -273,41 +275,43 @@ public class ConfigurationFrame * Handles registration of a new configuration form. * @param event the <tt>ServiceEvent</tt> that notified us */ + @Override public void serviceChanged(ServiceEvent event) { if(!GuiActivator.isStarted) return; - ServiceReference serRef = event.getServiceReference(); + ServiceReference<?> serRef = event.getServiceReference(); Object property = serRef.getProperty(ConfigurationForm.FORM_TYPE); if (property != ConfigurationForm.GENERAL_TYPE) return; - Object sService - = GuiActivator.bundleContext.getService( - event.getServiceReference()); + Object service = GuiActivator.bundleContext.getService(serRef); // we don't care if the source service is not a configuration form - if (!(sService instanceof ConfigurationForm)) + if (!(service instanceof ConfigurationForm)) return; - ConfigurationForm configForm = (ConfigurationForm) sService; + ConfigurationForm cfgForm = (ConfigurationForm) service; - if (configForm.isAdvanced()) + if (cfgForm.isAdvanced()) return; switch (event.getType()) { case ServiceEvent.REGISTERED: if (logger.isInfoEnabled()) - logger.info("Handling registration of a new Configuration Form."); - this.addConfigurationForm(configForm); + { + logger.info( + "Handling registration of a new Configuration Form."); + } + addConfigurationForm(cfgForm); break; case ServiceEvent.UNREGISTERING: - this.removeConfigurationForm(configForm); + removeConfigurationForm(cfgForm); break; } } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPane.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPane.java index 03890c6..fd598df 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPane.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPane.java @@ -812,58 +812,60 @@ public class ContactListPane { // Search for plugin components registered through the OSGI bundle // context. - ServiceReference[] serRefs = null; - - String osgiFilter = "(" - + Container.CONTAINER_ID - + "="+Container.CONTAINER_CONTACT_LIST.getID()+")"; + Collection<ServiceReference<PluginComponentFactory>> serRefs; + String osgiFilter + = "(" + Container.CONTAINER_ID + "=" + + Container.CONTAINER_CONTACT_LIST.getID() + ")"; try { - serRefs = GuiActivator.bundleContext.getServiceReferences( - PluginComponentFactory.class.getName(), - osgiFilter); + serRefs + = GuiActivator.bundleContext.getServiceReferences( + PluginComponentFactory.class, + osgiFilter); } - catch (InvalidSyntaxException exc) + catch (InvalidSyntaxException ex) { - logger.error("Could not obtain plugin reference.", exc); + serRefs = null; + logger.error("Could not obtain plugin reference.", ex); } - if (serRefs != null) + if ((serRefs != null) && !serRefs.isEmpty()) { - for (ServiceReference serRef : serRefs) + for (ServiceReference<PluginComponentFactory> serRef : serRefs) { - PluginComponentFactory factory = - (PluginComponentFactory) - GuiActivator.bundleContext.getService(serRef); - PluginComponent component = - factory.getPluginComponentInstance(this); + PluginComponentFactory factory + = GuiActivator.bundleContext.getService(serRef); + PluginComponent component + = factory.getPluginComponentInstance(this); Object selectedValue = getContactList().getSelectedValue(); if(selectedValue instanceof MetaContact) { - component.setCurrentContact((MetaContact)selectedValue); + component.setCurrentContact((MetaContact) selectedValue); } else if(selectedValue instanceof MetaContactGroup) { - component - .setCurrentContactGroup((MetaContactGroup)selectedValue); + component.setCurrentContactGroup( + (MetaContactGroup) selectedValue); } String pluginConstraints = factory.getConstraints(); Object constraints; if (pluginConstraints != null) - constraints = UIServiceImpl - .getBorderLayoutConstraintsFromContainer( - pluginConstraints); + { + constraints + = UIServiceImpl.getBorderLayoutConstraintsFromContainer( + pluginConstraints); + } else constraints = BorderLayout.SOUTH; - this.add((Component)component.getComponent(), constraints); + add((Component) component.getComponent(), constraints); - this.repaint(); + repaint(); } } diff --git a/src/net/java/sip/communicator/impl/protocol/irc/IrcStatusEnum.java b/src/net/java/sip/communicator/impl/protocol/irc/IrcStatusEnum.java index 637ed9d..5c0a4ab 100644 --- a/src/net/java/sip/communicator/impl/protocol/irc/IrcStatusEnum.java +++ b/src/net/java/sip/communicator/impl/protocol/irc/IrcStatusEnum.java @@ -8,7 +8,6 @@ package net.java.sip.communicator.impl.protocol.irc; import java.util.*; -import net.java.sip.communicator.impl.protocol.irc.*; import net.java.sip.communicator.service.protocol.*; /** diff --git a/src/net/java/sip/communicator/service/resources/AbstractResourcesService.java b/src/net/java/sip/communicator/service/resources/AbstractResourcesService.java index 0fe9028..0b38fdc 100644 --- a/src/net/java/sip/communicator/service/resources/AbstractResourcesService.java +++ b/src/net/java/sip/communicator/service/resources/AbstractResourcesService.java @@ -6,17 +6,19 @@ */ package net.java.sip.communicator.service.resources; -import net.java.sip.communicator.util.*; -import org.jitsi.service.configuration.*; -import org.jitsi.service.resources.*; -import org.osgi.framework.*; - -import javax.swing.*; import java.io.*; import java.net.*; import java.text.*; import java.util.*; +import javax.swing.*; + +import net.java.sip.communicator.util.*; + +import org.jitsi.service.configuration.*; +import org.jitsi.service.resources.*; +import org.osgi.framework.*; + /** * The abstract class for ResourceManagementService. It listens for * {@link ResourcePack} that are registered and exposes them later for use by @@ -109,16 +111,18 @@ public abstract class AbstractResourcesService this.bundleContext = bundleContext; bundleContext.addServiceListener(this); - colorPack = - getDefaultResourcePack(ColorPack.class.getName(), - ColorPack.RESOURCE_NAME_DEFAULT_VALUE); + colorPack + = getDefaultResourcePack( + ColorPack.class, + ColorPack.RESOURCE_NAME_DEFAULT_VALUE); if (colorPack != null) colorResources = getResources(colorPack); - imagePack = (ImagePack) getDefaultResourcePack( - ImagePack.class.getName(), - ImagePack.RESOURCE_NAME_DEFAULT_VALUE); + imagePack + = getDefaultResourcePack( + ImagePack.class, + ImagePack.RESOURCE_NAME_DEFAULT_VALUE); if (imagePack != null) imageResources = getResources(imagePack); @@ -132,9 +136,10 @@ public abstract class AbstractResourcesService Locale.setDefault( ResourceManagementServiceUtils.getLocale(defaultLocale)); - languagePack = (LanguagePack) getDefaultResourcePack( - LanguagePack.class.getName(), - LanguagePack.RESOURCE_NAME_DEFAULT_VALUE); + languagePack + = getDefaultResourcePack( + LanguagePack.class, + LanguagePack.RESOURCE_NAME_DEFAULT_VALUE); if (languagePack != null) { @@ -142,22 +147,26 @@ public abstract class AbstractResourcesService languageResources = languagePack.getResources(languageLocale); } - settingsPack = - getDefaultResourcePack(SettingsPack.class.getName(), - SettingsPack.RESOURCE_NAME_DEFAULT_VALUE); + settingsPack + = getDefaultResourcePack( + SettingsPack.class, + SettingsPack.RESOURCE_NAME_DEFAULT_VALUE); if (settingsPack != null) settingsResources = getResources(settingsPack); - soundPack = - getDefaultResourcePack(SoundPack.class.getName(), - SoundPack.RESOURCE_NAME_DEFAULT_VALUE); + soundPack + = getDefaultResourcePack( + SoundPack.class, + SoundPack.RESOURCE_NAME_DEFAULT_VALUE); if (soundPack != null) soundResources = getResources(soundPack); - skinPack = (SkinPack) getDefaultResourcePack( - SkinPack.class.getName(), SkinPack.RESOURCE_NAME_DEFAULT_VALUE); + skinPack + = getDefaultResourcePack( + SkinPack.class, + SkinPack.RESOURCE_NAME_DEFAULT_VALUE); if (skinPack != null) { @@ -247,48 +256,48 @@ public abstract class AbstractResourcesService if(resourcePack instanceof ColorPack && colorPack.equals(resourcePack)) { - colorPack = - getDefaultResourcePack(ColorPack.class.getName(), - ColorPack.RESOURCE_NAME_DEFAULT_VALUE); - + colorPack + = getDefaultResourcePack( + ColorPack.class, + ColorPack.RESOURCE_NAME_DEFAULT_VALUE); if (colorPack != null) colorResources = getResources(colorPack); } else if(resourcePack instanceof ImagePack && imagePack.equals(resourcePack)) { - imagePack = (ImagePack) getDefaultResourcePack( - ImagePack.class.getName(), - ImagePack.RESOURCE_NAME_DEFAULT_VALUE); - + imagePack + = getDefaultResourcePack( + ImagePack.class, + ImagePack.RESOURCE_NAME_DEFAULT_VALUE); if (imagePack != null) imageResources = getResources(imagePack); } else if(resourcePack instanceof LanguagePack && languagePack.equals(resourcePack)) { - languagePack = - (LanguagePack) getDefaultResourcePack( - LanguagePack.class.getName(), - LanguagePack.RESOURCE_NAME_DEFAULT_VALUE); + languagePack + = getDefaultResourcePack( + LanguagePack.class, + LanguagePack.RESOURCE_NAME_DEFAULT_VALUE); } else if(resourcePack instanceof SettingsPack && settingsPack.equals(resourcePack)) { - settingsPack = - getDefaultResourcePack(SettingsPack.class.getName(), - SettingsPack.RESOURCE_NAME_DEFAULT_VALUE); - + settingsPack + = getDefaultResourcePack( + SettingsPack.class, + SettingsPack.RESOURCE_NAME_DEFAULT_VALUE); if (settingsPack != null) settingsResources = getResources(settingsPack); } else if(resourcePack instanceof SoundPack && soundPack.equals(resourcePack)) { - soundPack = - getDefaultResourcePack(SoundPack.class.getName(), - SoundPack.RESOURCE_NAME_DEFAULT_VALUE); - + soundPack + = getDefaultResourcePack( + SoundPack.class, + SoundPack.RESOURCE_NAME_DEFAULT_VALUE); if (soundPack != null) soundResources = getResources(soundPack); } @@ -310,10 +319,10 @@ public abstract class AbstractResourcesService settingsResources = getResources(settingsPack); } - skinPack = (SkinPack) getDefaultResourcePack( - SkinPack.class.getName(), - SkinPack.RESOURCE_NAME_DEFAULT_VALUE); - + skinPack + = getDefaultResourcePack( + SkinPack.class, + SkinPack.RESOURCE_NAME_DEFAULT_VALUE); if (skinPack != null) { imageResources.putAll(skinPack.getImageResources()); @@ -341,28 +350,27 @@ public abstract class AbstractResourcesService * @return the <tt>ResourcePack</tt> corresponding to the given * <tt>className</tt> and <tt></tt>. */ - protected ResourcePack getDefaultResourcePack(String className, - String typeName) + protected <T extends ResourcePack> T getDefaultResourcePack( + Class<T> clazz, + String typeName) { - ServiceReference[] serRefs = null; - - String osgiFilter = - "(" + ResourcePack.RESOURCE_NAME + "=" + typeName + ")"; + Collection<ServiceReference<T>> serRefs; + String osgiFilter + = "(" + ResourcePack.RESOURCE_NAME + "=" + typeName + ")"; try { - serRefs = bundleContext.getServiceReferences( - className, - osgiFilter); + serRefs = bundleContext.getServiceReferences(clazz, osgiFilter); } - catch (InvalidSyntaxException exc) + catch (InvalidSyntaxException ex) { - logger.error("Could not obtain resource packs reference.", exc); + serRefs = null; + logger.error("Could not obtain resource packs reference.", ex); } - if ((serRefs != null) && (serRefs.length > 0)) + if ((serRefs != null) && !serRefs.isEmpty()) { - return (ResourcePack) bundleContext.getService(serRefs[0]); + return bundleContext.getService(serRefs.iterator().next()); } return null; } diff --git a/src/net/java/sip/communicator/util/Entities.java b/src/net/java/sip/communicator/util/Entities.java index 3170759..21d179d 100644 --- a/src/net/java/sip/communicator/util/Entities.java +++ b/src/net/java/sip/communicator/util/Entities.java @@ -1028,7 +1028,7 @@ class Entities { */ private static class Entry { final int hash; - final int key; +// final int key; Object value; Entry next; @@ -1042,7 +1042,7 @@ class Entities { */ protected Entry(int hash, int key, Object value, Entry next) { this.hash = hash; - this.key = key; +// this.key = key; this.value = value; this.next = next; } diff --git a/src/net/java/sip/communicator/util/UtilActivator.java b/src/net/java/sip/communicator/util/UtilActivator.java index 7c3b43e..ca08f47 100644 --- a/src/net/java/sip/communicator/util/UtilActivator.java +++ b/src/net/java/sip/communicator/util/UtilActivator.java @@ -228,30 +228,30 @@ public class UtilActivator public static Map<Object, ProtocolProviderFactory> getProtocolProviderFactories() { + Collection<ServiceReference<ProtocolProviderFactory>> serRefs; Map<Object, ProtocolProviderFactory> providerFactoriesMap = new Hashtable<Object, ProtocolProviderFactory>(); - ServiceReference[] serRefs = null; try { // get all registered provider factories serRefs = bundleContext.getServiceReferences( - ProtocolProviderFactory.class.getName(), + ProtocolProviderFactory.class, null); } - catch (InvalidSyntaxException e) + catch (InvalidSyntaxException ex) { - logger.error("LoginManager : " + e); + serRefs = null; + logger.error("LoginManager : " + ex); } - if (serRefs != null) + if ((serRefs != null) && !serRefs.isEmpty()) { - for (ServiceReference serRef : serRefs) + for (ServiceReference<ProtocolProviderFactory> serRef : serRefs) { ProtocolProviderFactory providerFactory - = (ProtocolProviderFactory) - bundleContext.getService(serRef); + = bundleContext.getService(serRef); providerFactoriesMap.put( serRef.getProperty(ProtocolProviderFactory.PROTOCOL), diff --git a/src/net/java/sip/communicator/util/call/MetaContactPhoneUtil.java b/src/net/java/sip/communicator/util/call/MetaContactPhoneUtil.java index 99e553e..bd219a2 100644 --- a/src/net/java/sip/communicator/util/call/MetaContactPhoneUtil.java +++ b/src/net/java/sip/communicator/util/call/MetaContactPhoneUtil.java @@ -6,15 +6,18 @@ */ package net.java.sip.communicator.util.call; +import java.util.*; + import net.java.sip.communicator.service.contactlist.*; import net.java.sip.communicator.service.protocol.*; -import net.java.sip.communicator.service.protocol.OperationSetServerStoredContactInfo.*; -import net.java.sip.communicator.service.protocol.ServerStoredDetails.*; +import net.java.sip.communicator.service.protocol.OperationSetServerStoredContactInfo.DetailsResponseListener; +import net.java.sip.communicator.service.protocol.ServerStoredDetails.GenericDetail; +import net.java.sip.communicator.service.protocol.ServerStoredDetails.MobilePhoneDetail; +import net.java.sip.communicator.service.protocol.ServerStoredDetails.VideoDetail; +import net.java.sip.communicator.service.protocol.ServerStoredDetails.WorkPhoneDetail; import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.account.*; -import java.util.*; - /** * Utility class used to check if there is a telephony service, video calls and * desktop sharing enabled for a protocol specific <tt>MetaContact</tt>. @@ -25,13 +28,6 @@ import java.util.*; public class MetaContactPhoneUtil { /** - * The <tt>Logger</tt> used by the <tt>CallManager</tt> class and its - * instances for logging output. - */ - private static final Logger logger - = Logger.getLogger(MetaContactPhoneUtil.class); - - /** * The metacontcat we are working on. */ private MetaContact metaContact; |