Trying out plugins for Spark (Reversi)

Hi! I don’t know if this one have been posted already. Anyways, this is my problem. I am trying to write a plugin for my project and so I opted to test first some of the plugins that comes with the Spark source. I built (build) reversi using “ant” and fortunately have done it successfully. I attached the “reversi.jar” into the plugins directory of my installed Spark and then run Spark. I checked the plugins from Spark and it says that it is installed, but when I try to check the it out with chat, no icons can be found. I checked the logs and found this:

01 10, 08 11:46:08 PM org.jivesoftware.spark.util.log.Log error

SEVERE:

java.lang.NullPointerException

at javax.swing.ImageIcon.<init>(Unknown Source)

at org.jivesoftware.game.reversi.ReversiPlugin$5.<init>(ReversiPlugin.java:1 96)

at org.jivesoftware.game.reversi.ReversiPlugin.addToolbarButton(ReversiPlugin.java :194)

at org.jivesoftware.game.reversi.ReversiPlugin.initialize(ReversiPlugin.java:57)

at org.jivesoftware.spark.PluginManager$1.run(PluginManager.java:404)

at java.awt.event.InvocationEvent.dispatch(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

have I done something wrong when I built the jar file? I just typed “ant” from the folder containing the build.xml file in reversi. I hope someone could post a reply real soon.

Finally solved the problem of the error:

01 10, 08 11:46:08 PM org.jivesoftware.spark.util.log.Log error

SEVERE:

java.lang.NullPointerException

at javax.swing.ImageIcon.<init>(Unknown Source)

at org.jivesoftware.game.reversi.ReversiPlugin$5.<init>(ReversiPlugin.java:1 96)

at org.jivesoftware.game.reversi.ReversiPlugin.addToolbarButton(ReversiPlugin.java :194)

at org.jivesoftware.game.reversi.ReversiPlugin.initialize(ReversiPlugin.java:57)

at org.jivesoftware.spark.PluginManager$1.run(PluginManager.java:404)

at java.awt.event.InvocationEvent.dispatch(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

Found out that the error is caused by returning NULL as value for ImageIcon imageIcon. I modify the code from:

ImageIcon imageIcon = new ImageIcon(getClass().getResource(“images/reversi-icon.png”));

to -> ImageIcon imageIcon = new ImageIcon(getClass().getClassLoader().getResource(“images/reversi-icon.png”));

One also has to remove “Reversi” from : ChatRoomButton button = new ChatRoomButton(“Reversi”,icon); in chatRoomOpened() method.

Still have some problems though as there seemed to be no actioned performed whenever one clicks on the “Accept” or “Decline” buttons.