Quantcast
Channel: Ignite Realtime: Message List
Viewing all articles
Browse latest Browse all 12162

Re: Spark visually shows that a message is not sent

$
0
0

Hi,

I have installed Openfire/Spark in my office. Every day about 500 people use it. We often experience similar problems.


These problems happen because when we start the program static fields (TO_COLOR, FROM_COLOR, NOTIFICATION_COLOR and ERROR_COLOR) of ChatManager class are initialized as null, as class is loaded before loadLookAndFeel function of org.jivesoftware.Spark class executed.


I first tried to do a check before using these field. For example, in org.jivesoftware.spark.ui.TranscriptWindow class in insertMessage method:

if (foreground != null) {

     StyleConstants.setForeground(styles, foreground);

}


It didn’t solve the problem, because similar problems arise elsewhere (alot places, where using these static fields).

I later realized the nature of the problem. It lies in startupPerformed event org.jivesoftware.SparkStartupListener class.It’s event used for XEP-0147, but sometimes and mostly during the program autoload this event occurs prior to start of basic program in org.jivesoftware.Spark. During the autoload the initialization of ChatManager fields is executed (prior to loadLookAndFeel function of org.jivesoftware.Spark class). But in this case the method is executed with an empty argument.


I solved the problem adding the following validation in org.jivesoftware.SparkStartupListener class:

old code:

final ChatManager chatManager = SparkManager.getChatManager();

chatManager.handleURIMapping(arguments);

 

new code:

if (args != null && !args.trim().isEmpty()) {

     final ChatManager chatManager = SparkManager.getChatManager();

     chatManager.handleURIMapping(arguments);

}


I have had no problems since I did that.

I hope it works for you.


Viewing all articles
Browse latest Browse all 12162

Trending Articles