Fixes warnings.

cefexperiments
Lyubomir Marinov 11 years ago
parent 6a23358a8d
commit a613195ef4

@ -8,6 +8,7 @@
import net.java.sip.communicator.service.browserlauncher.*;
import net.java.sip.communicator.util.*;
import org.jitsi.service.configuration.*;
import org.osgi.framework.*;
@ -15,7 +16,7 @@
* Implements <tt>BundleActivator</tt> for the browserlauncher bundle.
*
* @author Yana Stamcheva
* @author Lubomir Marinov
* @author Lyubomir Marinov
* @author Pawel Domas
*/
public class BrowserLauncherActivator
@ -73,11 +74,10 @@ public static ConfigurationService getConfigurationService()
{
if (configService == null && bundleContext != null)
{
ServiceReference serviceReference = bundleContext
.getServiceReference(ConfigurationService.class.getName());
configService = (ConfigurationService)bundleContext
.getService(serviceReference);
configService
= ServiceUtils.getService(
bundleContext,
ConfigurationService.class);
}
return configService;

@ -68,11 +68,8 @@ public void start(BundleContext bc) throws Exception
try{
logger.logEntry();
ServiceReference refHistory = bundleContext.getServiceReference(
HistoryService.class.getName());
HistoryService historyService = (HistoryService)
bundleContext.getService(refHistory);
HistoryService historyService
= ServiceUtils.getService(bundleContext, HistoryService.class);
//Create and start the call history service.
callHistoryService =
@ -150,27 +147,28 @@ public static ResourceManagementService getResources()
public static Map<Object, ProtocolProviderFactory>
getProtocolProviderFactories()
{
ServiceReference[] serRefs = null;
Collection<ServiceReference<ProtocolProviderFactory>> serRefs;
try
{
// get all registered provider factories
serRefs =
bundleContext.getServiceReferences(
ProtocolProviderFactory.class.getName(), null);
serRefs
= bundleContext.getServiceReferences(
ProtocolProviderFactory.class,
null);
}
catch (InvalidSyntaxException e)
{
serRefs = null;
logger.error("LoginManager : " + e);
}
if (serRefs != null)
{
for (ServiceReference serRef : serRefs)
for (ServiceReference<ProtocolProviderFactory> serRef : serRefs)
{
ProtocolProviderFactory providerFactory
= (ProtocolProviderFactory)
bundleContext.getService(serRef);
= bundleContext.getService(serRef);
providerFactoriesMap.put(
serRef.getProperty(ProtocolProviderFactory.PROTOCOL),

@ -618,39 +618,35 @@ public void start(BundleContext bc)
// start listening for newly register or removed protocol providers
bc.addServiceListener(this);
ServiceReference[] protocolProviderRefs = null;
Collection<ServiceReference<ProtocolProviderService>> ppsRefs;
try
{
protocolProviderRefs
= bc.getServiceReferences(
ProtocolProviderService.class.getName(),
null);
ppsRefs
= bc.getServiceReferences(ProtocolProviderService.class, null);
}
catch (InvalidSyntaxException ex)
{
ppsRefs = null;
// this shouldn't happen since we're providing no parameter string
// but let's log just in case.
logger.error("Error while retrieving service refs", ex);
}
// in case we found any
if (protocolProviderRefs != null)
if (ppsRefs != null)
{
if (logger.isDebugEnabled())
{
logger.debug(
"Found "
+ protocolProviderRefs.length
"Found " + ppsRefs.size()
+ " already installed providers.");
}
for (ServiceReference protocolProviderRef : protocolProviderRefs)
for (ServiceReference<ProtocolProviderService> ppsRef : ppsRefs)
{
ProtocolProviderService provider
= (ProtocolProviderService)
bc.getService(protocolProviderRef);
ProtocolProviderService pps = bc.getService(ppsRef);
this.handleProviderAdded(provider);
this.handleProviderAdded(pps);
}
}
}
@ -664,32 +660,29 @@ public void stop(BundleContext bc)
{
bc.removeServiceListener(this);
ServiceReference[] protocolProviderRefs = null;
Collection<ServiceReference<ProtocolProviderService>> ppsRefs;
try
{
protocolProviderRefs
= bc.getServiceReferences(
ProtocolProviderService.class.getName(),
null);
ppsRefs
= bc.getServiceReferences(ProtocolProviderService.class, null);
}
catch (InvalidSyntaxException ex)
{
ppsRefs = null;
// this shouldn't happen since we're providing no parameter string
// but let's log just in case.
logger.error("Error while retrieving service refs", ex);
}
// in case we found any
if (protocolProviderRefs != null)
if (ppsRefs != null)
{
for (ServiceReference protocolProviderRef : protocolProviderRefs)
for (ServiceReference<ProtocolProviderService> ppsRef : ppsRefs)
{
ProtocolProviderService provider
= (ProtocolProviderService)
bc.getService(protocolProviderRef);
ProtocolProviderService pps = bc.getService(ppsRef);
this.handleProviderRemoved(provider);
this.handleProviderRemoved(pps);
}
}
}

@ -91,10 +91,10 @@ public void startCandidateHarvest(SessionDescription ourOffer,
iceAgent.setControlling(true);
//add the candidate attributes and set default candidates
for(MediaDescription mLine : SdpUtils.extractMediaDescriptions(ourOffer))
for(MediaDescription mLine
: SdpUtils.extractMediaDescriptions(ourOffer))
{
IceMediaStream iceStream = createIceStream(
SdpUtils.getMediaType(mLine).toString(), iceAgent);
createIceStream(SdpUtils.getMediaType(mLine).toString(), iceAgent);
}
//now that our iceAgent is ready, reflect it on our offer.
@ -134,7 +134,7 @@ public void startCandidateHarvest( SessionDescription theirOffer,
* @return the content list that we received earlier (possibly cloned into
* a new instance) and that we have updated with transport lists.
*/
public List<Candidate> wrapupCandidateHarvest()
public List<Candidate<?>> wrapupCandidateHarvest()
{
return null;
}

@ -11,7 +11,7 @@
import net.java.sip.communicator.service.credentialsstorage.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.Base64; // disambiguation
import net.java.sip.communicator.util.Base64;
import org.jitsi.service.configuration.*;
import org.osgi.framework.*;
@ -20,7 +20,7 @@
* Represents an implementation of <tt>AccountManager</tt> which loads the
* accounts in a separate thread.
*
* @author Lubomir Marinov
* @author Lyubomir Marinov
* @author Yana Stamcheva
*/
public class AccountManager
@ -286,35 +286,37 @@ public boolean hasStoredAccount(String protocolName,
boolean includeHidden,
String userID)
{
ServiceReference[] factoryRefs = null;
Collection<ServiceReference<ProtocolProviderFactory>> factoryRefs;
boolean hasStoredAccounts = false;
try
{
factoryRefs
= bundleContext.getServiceReferences(
ProtocolProviderFactory.class.getName(), null);
ProtocolProviderFactory.class,
null);
}
catch (InvalidSyntaxException ex)
{
factoryRefs = null;
logger.error(
"Failed to retrieve the registered ProtocolProviderFactories",
ex);
}
if ((factoryRefs != null) && (factoryRefs.length > 0))
if ((factoryRefs != null) && !factoryRefs.isEmpty())
{
ConfigurationService configService
= ProtocolProviderActivator.getConfigurationService();
for (ServiceReference factoryRef : factoryRefs)
for (ServiceReference<ProtocolProviderFactory> factoryRef
: factoryRefs)
{
ProtocolProviderFactory factory
= (ProtocolProviderFactory)
bundleContext.getService(factoryRef);
= bundleContext.getService(factoryRef);
if ((protocolName != null)
&& !protocolName.equals(factory.getProtocolName()))
&& !protocolName.equals(factory.getProtocolName()))
{
continue;
}
@ -397,31 +399,33 @@ else if(userID == null)
*/
public AccountID findAccountID(String uid)
{
ServiceReference[] factoryRefs = null;
Collection<ServiceReference<ProtocolProviderFactory>> factoryRefs;
try
{
factoryRefs
= bundleContext.getServiceReferences(
ProtocolProviderFactory.class.getName(), null);
ProtocolProviderFactory.class,
null);
}
catch (InvalidSyntaxException ex)
{
factoryRefs = null;
logger.error(
"Failed to retrieve the registered ProtocolProviderFactories",
ex);
}
if ((factoryRefs != null) && (factoryRefs.length > 0))
if ((factoryRefs != null) && !factoryRefs.isEmpty())
{
ConfigurationService configService
= ProtocolProviderActivator.getConfigurationService();
for (ServiceReference factoryRef : factoryRefs)
for (ServiceReference<ProtocolProviderFactory> factoryRef
: factoryRefs)
{
ProtocolProviderFactory factory
= (ProtocolProviderFactory)
bundleContext.getService(factoryRef);
= bundleContext.getService(factoryRef);
String factoryPackage = getFactoryImplPackageName(factory);
List<String> storedAccountsProps
@ -508,8 +512,8 @@ public void run()
}
};
loadStoredAccountsThread.setDaemon(true);
loadStoredAccountsThread
.setName("AccountManager.loadStoredAccounts");
loadStoredAccountsThread.setName(
"AccountManager.loadStoredAccounts");
loadStoredAccountsThread.start();
}
}
@ -1022,15 +1026,15 @@ public void unloadAccount(AccountID accountID)
accountID.getProtocolName());
// Obtain the protocol provider.
ServiceReference serRef
ServiceReference<ProtocolProviderService> serRef
= providerFactory.getProviderForAccount(accountID);
// If there's no such provider we have nothing to do here.
if (serRef == null)
return;
ProtocolProviderService protocolProvider =
(ProtocolProviderService) bundleContext.getService(serRef);
ProtocolProviderService protocolProvider
= bundleContext.getService(serRef);
// Set the account icon path for unloaded accounts.
String iconPathProperty = accountID.getAccountPropertyString(

@ -6,6 +6,8 @@
*/
package net.java.sip.communicator.service.protocol;
import java.util.*;
import net.java.sip.communicator.service.protocol.event.*;
import org.osgi.framework.*;
@ -13,17 +15,15 @@
/**
* Provides utilities to aid the manipulation of {@link AccountManager}.
*
* @author Lubomir Marinov
* @author Lyubomir Marinov
*/
public final class AccountManagerUtils
{
private static AccountManager getAccountManager(BundleContext bundleContext)
{
return
(AccountManager)
bundleContext.getService(
bundleContext.getServiceReference(
AccountManager.class.getName()));
bundleContext.getService(
bundleContext.getServiceReference(AccountManager.class));
}
/**
@ -92,14 +92,13 @@ public void handleAccountManagerEvent(AccountManagerEvent event)
if (bundleContext == null)
return;
ServiceReference[] factoryRefs;
Collection<ServiceReference<ProtocolProviderFactory>> factoryRefs;
try
{
factoryRefs
= bundleContext
.getServiceReferences(
ProtocolProviderFactory.class.getName(),
= bundleContext.getServiceReferences(
ProtocolProviderFactory.class,
"("
+ ProtocolProviderFactory.PROTOCOL
+ "="
@ -119,13 +118,15 @@ public void handleAccountManagerEvent(AccountManagerEvent event)
{
boolean factoryIsRegistered = false;
for (ServiceReference factoryRef : factoryRefs)
for (ServiceReference<ProtocolProviderFactory> factoryRef
: factoryRefs)
{
if (factory == bundleContext.getService(factoryRef))
{
factoryIsRegistered = true;
break;
}
}
if (!factoryIsRegistered)
return;
}

Loading…
Cancel
Save