Personal tools
You are here: Home Forum Nice Office Access (NOA) NPE in EditorUIPlugin

 • NPE in EditorUIPlugin

Replies: 0   Views: 131
Up one level

 • NPE in EditorUIPlugin

Posted by RuiRosado at 2010-12-18 22:13:59
Dear all,

I have a RCP application with a perspective where I can open different editors in the editorpart.
One of these editors is an instance of OfficeEditor.
When I start this application, and open e.g. an OpenOffice writer document, this works great, and I can close my application without errors.
If, however, I start this application without opening an OpenOffice document, or if I only open another editor, I will get a NPE exception when closing the application:

org.osgi.framework.BundleException: Exception in ag.ion.bion.workbench.office.editor.ui.EditorUIPlugin.stop() of bundle ag.ion.bion.workbench.office.editor.ui. ...

This seems to be caused because EditorCorePlugin.getDefault() returns NULL when no OfficeEditor has been opened yet.

I solved this problem by editting the stop() method in EditorUIPlugin.java:

public void stop(BundleContext context) throws Exception {
if( EditorCorePlugin.getDefault() != null) {
try {
EditorCorePlugin.getDefault().getManagedLocalOfficeApplication().getDesktopService().deactivateTerminationPrevention();
}
catch (OfficeApplicationException officeApplicationException) {
//no prevention
}
}
super.stop(context);
}

My questions:

1. Is this the best way to solve this problem?
2. If so, can it then be integrated in a next build so that I do not need to do this for every new release of NOA?

Thank you very much for a reply.
Cheers,
Rui
RuiRosado Member
Posts: 6

Powered by Plone, the Open Source Content Management System

This site conforms to the following standards: