diff options
author | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2014-09-29 01:12:42 +0300 |
---|---|---|
committer | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2014-09-29 01:12:42 +0300 |
commit | 15f40128402690804efd9e948234f12a4e7d5050 (patch) | |
tree | c2248255f618ce7267de10b17280dd9b1858fcaa /src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java | |
parent | a613195ef42ca5a88e663b17d6419ab4a6db1891 (diff) | |
download | jitsi-15f40128402690804efd9e948234f12a4e7d5050.zip jitsi-15f40128402690804efd9e948234f12a4e7d5050.tar.gz jitsi-15f40128402690804efd9e948234f12a4e7d5050.tar.bz2 |
Fixes warnings, bugs. Reduces source code duplication. Simplifies, clarifies source code.
Diffstat (limited to 'src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java')
-rw-r--r-- | src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java | 49 |
1 files changed, 17 insertions, 32 deletions
diff --git a/src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java b/src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java index e85dced..0a3748b 100644 --- a/src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java +++ b/src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java @@ -25,12 +25,6 @@ public class SecurityConfigActivator implements BundleActivator { /** - * The logger. - */ - private static Logger logger - = Logger.getLogger(SecurityConfigActivator.class); - - /** * The {@link BundleContext} of the {@link SecurityConfigActivator}. */ public static BundleContext bundleContext; @@ -85,8 +79,10 @@ public class SecurityConfigActivator { bundleContext = bc; + ConfigurationService cfg = getConfigurationService(); + // If the security configuration form is disabled don't continue. - if (getConfigurationService().getBoolean(DISABLED_PROP, false)) + if (cfg.getBoolean(DISABLED_PROP, false)) return; // Register the configuration form. @@ -106,8 +102,7 @@ public class SecurityConfigActivator properties); // If the master password config form is disabled don't register it. - if(!getConfigurationService() - .getBoolean(MASTER_PASSWORD_DISABLED_PROP, false)) + if(!cfg.getBoolean(MASTER_PASSWORD_DISABLED_PROP, false)) { properties = new Hashtable<String, String>(); properties.put( ConfigurationForm.FORM_TYPE, @@ -233,33 +228,23 @@ public class SecurityConfigActivator private static Map<Object, ProtocolProviderFactory> getProtocolProviderFactories() { - ServiceReference[] serRefs = null; - try - { - // get all registered provider factories - serRefs = - bundleContext.getServiceReferences( - ProtocolProviderFactory.class.getName(), null); - - } - catch (InvalidSyntaxException ex) - { - logger.error("Error while retrieving service refs", ex); - return null; - } + Collection<ServiceReference<ProtocolProviderFactory>> serRefs + = ServiceUtils.getServiceReferences( + bundleContext, + ProtocolProviderFactory.class); + Map<Object, ProtocolProviderFactory> providerFactoriesMap + = new Hashtable<Object, ProtocolProviderFactory>(); - Map<Object, ProtocolProviderFactory> providerFactoriesMap = - new Hashtable<Object, ProtocolProviderFactory>(); - if (serRefs != null) + if ((serRefs != null) && !serRefs.isEmpty()) { - for (ServiceReference serRef : serRefs) + for (ServiceReference<ProtocolProviderFactory> serRef : serRefs) { - ProtocolProviderFactory providerFactory = - (ProtocolProviderFactory) bundleContext.getService(serRef); + ProtocolProviderFactory providerFactory + = bundleContext.getService(serRef); - providerFactoriesMap.put(serRef - .getProperty(ProtocolProviderFactory.PROTOCOL), - providerFactory); + providerFactoriesMap.put( + serRef.getProperty(ProtocolProviderFactory.PROTOCOL), + providerFactory); } } return providerFactoriesMap; |