Fixes NPE that can prevent loading global status service.

fix-message-formatting
Damian Minkov 12 years ago
parent 33c748af5a
commit 4ac6ac46e8

@ -90,9 +90,14 @@ public void start(BundleContext bc)
*/
private void handleAlreadyRegisteredProviders()
{
for (ServiceReference protocolProviderRef :
ServiceUtils.getServiceReferences(
bundleContext, ProtocolProviderService.class))
ServiceReference[] providerRefs
= ServiceUtils.getServiceReferences(
bundleContext, ProtocolProviderService.class);
if(providerRefs == null)
return;
for (ServiceReference protocolProviderRef : providerRefs)
{
ProtocolProviderService provider
= (ProtocolProviderService)

@ -136,6 +136,7 @@ public ConferencePeerPanel(
callPeerAdapter = null;
String globalDisplayName = null;
// Try to set the same image as the one in the main window. This way
// we improve our chances to have an image, instead of looking only at
// the protocol provider avatar, which could be null, we look for any
@ -143,15 +144,19 @@ public ConferencePeerPanel(
GlobalDisplayDetailsService displayDetailsService
= GuiActivator.getGlobalDisplayDetailsService();
byte[] globalAccountImage
= displayDetailsService.getGlobalDisplayAvatar();
if(displayDetailsService != null)
{
byte[] globalAccountImage
= displayDetailsService.getGlobalDisplayAvatar();
if((globalAccountImage != null) && (globalAccountImage.length > 0))
setPeerImage(globalAccountImage);
if ((globalAccountImage != null) && (globalAccountImage.length > 0))
setPeerImage(globalAccountImage);
globalDisplayName = displayDetailsService.getGlobalDisplayName();
}
ResourceManagementService resources = GuiActivator.getResources();
String globalDisplayName = displayDetailsService.getGlobalDisplayName();
setPeerName(
(globalDisplayName != null && globalDisplayName.length() > 0)
? globalDisplayName

@ -17,6 +17,7 @@
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.plugin.desktoputil.*;
import net.java.sip.communicator.plugin.desktoputil.presence.avatar.*;
import net.java.sip.communicator.service.globaldisplaydetails.*;
import net.java.sip.communicator.service.globaldisplaydetails.event.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.gui.Container;
@ -181,15 +182,18 @@ public AccountStatusPanel()
loadSkin();
GuiActivator.getUIService().addPluginComponentListener(this);
GuiActivator.getGlobalDisplayDetailsService()
.addGlobalDisplayDetailsListener(this);
String globalDisplayName
= GuiActivator.getGlobalDisplayDetailsService()
.getGlobalDisplayName();
GlobalDisplayDetailsService gDService
= GuiActivator.getGlobalDisplayDetailsService();
if(gDService != null)
{
gDService.addGlobalDisplayDetailsListener(this);
String globalDisplayName = gDService.getGlobalDisplayName();
if(!StringUtils.isNullOrEmpty(globalDisplayName))
accountNameLabel.setText(globalDisplayName);
if(!StringUtils.isNullOrEmpty(globalDisplayName))
accountNameLabel.setText(globalDisplayName);
}
}
/**
@ -545,8 +549,14 @@ public void loadSkin()
GuiActivator.getUIService().addPluginComponentListener(this);
byte[] avatar = GuiActivator.getGlobalDisplayDetailsService()
.getGlobalDisplayAvatar();
byte[] avatar = null;
if(GuiActivator.getGlobalDisplayDetailsService() != null)
{
avatar = GuiActivator.getGlobalDisplayDetailsService()
.getGlobalDisplayAvatar();
}
if (avatar == null || avatar.length <= 0)
accountImageLabel.setImageIcon(ImageLoader
.getImage(ImageLoader.DEFAULT_USER_PHOTO));

@ -352,8 +352,11 @@ public void actionPerformed(ActionEvent e)
JMenuItem menuItem = (JMenuItem) e.getSource();
String itemName = menuItem.getName();
GuiActivator.getGlobalStatusService().publishStatus(
GlobalStatusEnum.getStatusByName(itemName));
if(GuiActivator.getGlobalStatusService() != null)
{
GuiActivator.getGlobalStatusService().publishStatus(
GlobalStatusEnum.getStatusByName(itemName));
}
}
/**
@ -415,6 +418,9 @@ public void updateStatus(ProtocolProviderService protocolProvider,
*/
private void updateGlobalStatus()
{
if(GuiActivator.getGlobalStatusService() == null)
return;
PresenceStatus globalStatus
= GuiActivator.getGlobalStatusService().getGlobalPresenceStatus();

@ -127,6 +127,9 @@ private JCheckBoxMenuItem createMenuItem(
*/
public void actionPerformed(ActionEvent e)
{
if(GuiActivator.getGlobalStatusService() == null)
return;
JMenuItem menuItem = (JMenuItem) e.getSource();
String itemName = menuItem.getName();

@ -960,6 +960,9 @@ && matches(propIndex, (String) prop)
logger.trace("For query: " + query + " found contact:"
+ sourceContact.getDisplayName() + ", "
+ sourceContact.getContactAddress());
long l = System.currentTimeMillis();
logger.info("Found match " + (l - previousMatch));
previousMatch = l;
addQueryResult(sourceContact);
}
@ -1040,9 +1043,13 @@ protected void run()
{
synchronized (MsOutlookAddrBookContactQuery.class)
{
long l1 = System.currentTimeMillis();
previousMatch = l1;
foreachMailUser(
query.toString(),
new PtrOutlookContactCallback());
logger.info("Query For Ids for: " + query + " execution "
+ (System.currentTimeMillis() - l1));
}
}
@ -1084,6 +1091,8 @@ public void finishedNotifications()
}
}
long previousMatch = 0;
/**
* Callback method when receiving notifications for updated items.
*

Loading…
Cancel
Save