Page 1 of 1

Wandora and Eclipse RCP

PostPosted: Fri May 15, 2009 12:09 am
by barab
Hello,
I am wondering if anyone has looked at integrating Wandora into the Eclipse Rich Client Platform (RCP) as a plugin. I am starting to look at doing this for something I need to work on, but I am running into a roadblock in my first step of the process.. getting the Wandora project to compile and run under Eclipse.

I am getting this exception right now on startup and I am having trouble figuring out how to get around it.

java.lang.NullPointerException
at org.wandora.application.WandoraMenuManager.getSubjectLocatorExtractorMenu(WandoraMenuManager.java:1171)
at org.wandora.application.WandoraMenuManager.getSubjectLocatorExtractorMenu(WandoraMenuManager.java:1165)
at org.wandora.application.WandoraMenuManager.refreshExtractWithSLMenu(WandoraMenuManager.java:1157)
at org.wandora.application.WandoraMenuManager.refreshExtractMenu(WandoraMenuManager.java:197)
at org.wandora.application.WandoraMenuManager.refreshFileMenu(WandoraMenuManager.java:592)
at org.wandora.application.WandoraMenuManager.refreshMenus(WandoraMenuManager.java:134)
at org.wandora.application.WandoraMenuManager.<init>(WandoraMenuManager.java:125)
at org.wandora.application.Wandora.initializeWandora(Wandora.java:348)
at org.wandora.application.Wandora.<init>(Wandora.java:158)
at org.wandora.application.Wandora.main(Wandora.java:2249)


Any help would be greatly appriciated! Thank you!

PostPosted: Fri May 15, 2009 1:08 pm
by akivela
Hello

Great idea! I hope you can share your work with us and other Wandora users later on.

To solve the NullPointerException with a quick hack, you can change the method getSubjectLocatorExtractorMenu so that it returns empty Object array:

Code: Select all
public static final Object[] getSubjectLocatorExtractorMenu(Wandora admin, Context proposedContext, WandoraToolSet extractTools) {
 return new Object[] {};
}


To think more permanent solution, it looks like the argument extractTools passed to the method getSubjectLocatorExtractorMenu is null. Argument extractTools is initialized in class WandoraToolManager2 with method readToolSets. In general all tool sets are defined in Wandora's options file (in resources/conf/options.xml). Wandora reads this options file in constructor of Wandora class. Note, options are read using Java's resource loader which means that options file directory 'resources' must be a valid Java class path.

I would suggest that you first check that Wandora actually loads options file successfully. I assume adding 'resources' to your Java class paths solves the problem. If this doesn't help, please drop a line and let's look your problem more detailed.

Kind Regards,
Aki Kivelä
Wandora Team

PostPosted: Fri May 15, 2009 4:57 pm
by barab
Thanks for the reply! I have added the resources folder as part of the Eclipse build/class path and the Wandora app can correctly access the files. I have noticed that the options.xml file was nearly empty, options.xml.original had alot more content, including all the information about tools to load. I copied the contents of options.xml.orginal to options.xml and ran again and got a different exception.

Code: Select all
Reading options from resource 'conf/options.xml'.
org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.
   at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1213)
   at org.apache.xerces.framework.XMLDocumentScanner.reportFatalXMLError(XMLDocumentScanner.java:570)
   at org.apache.xerces.framework.XMLDocumentScanner.abortMarkup(XMLDocumentScanner.java:624)
   at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1194)
   at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
   at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
   at org.wandora.utils.XMLbox.getDocument(XMLbox.java:63)
   at org.wandora.utils.XMLbox.getAsHashMapTree(XMLbox.java:309)
   at org.wandora.utils.Options.parseOptions(Options.java:378)
   at org.wandora.utils.Options.parseOptions(Options.java:369)
   at org.wandora.utils.Options.<init>(Options.java:88)
   at org.wandora.application.Wandora.<init>(Wandora.java:152)
   at org.wandora.application.Wandora.main(Wandora.java:2249)
java.lang.NumberFormatException: null
   at java.lang.Integer.parseInt(Unknown Source)
   at java.lang.Integer.parseInt(Unknown Source)
   at org.wandora.application.Wandora.placeWindow(Wandora.java:601)
   at org.wandora.application.Wandora.initializeWandora(Wandora.java:330)
   at org.wandora.application.Wandora.<init>(Wandora.java:158)
   at org.wandora.application.Wandora.main(Wandora.java:2249)
java.lang.NullPointerException
   at org.wandora.application.WandoraMenuManager.getSubjectLocatorExtractorMenu(WandoraMenuManager.java:1171)
   at org.wandora.application.WandoraMenuManager.getSubjectLocatorExtractorMenu(WandoraMenuManager.java:1165)
   at org.wandora.application.WandoraMenuManager.refreshExtractWithSLMenu(WandoraMenuManager.java:1157)
   at org.wandora.application.WandoraMenuManager.refreshExtractMenu(WandoraMenuManager.java:197)
   at org.wandora.application.WandoraMenuManager.refreshFileMenu(WandoraMenuManager.java:592)
   at org.wandora.application.WandoraMenuManager.refreshMenus(WandoraMenuManager.java:134)
   at org.wandora.application.WandoraMenuManager.<init>(WandoraMenuManager.java:125)
   at org.wandora.application.Wandora.initializeWandora(Wandora.java:348)
   at org.wandora.application.Wandora.<init>(Wandora.java:158)
   at org.wandora.application.Wandora.main(Wandora.java:2249)
Deleting file 'D:\workspace\Wandora\.\resources\conf\options.xml.bak'
Renaming file './resources/conf/options.xml' to './resources/conf/options.xml.bak'!
Saving a file './resources/conf/options.xml'


It seems that at the end of execution, it clears the options.xml file removing all the tools information, so if I run the application again I get the orginal exception that was in my first post. Any ideas?

Update: I have seemed to fix my own problem. I copied a fresh options.xml file from the source archive and now I can compile and run under Eclipse. Thanks again, I am sure that I will come across more issues that I'll need help with! :D