Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Null Pointer exception while Save As
Null Pointer exception while Save As [message #186608] Tue, 13 May 2008 11:38 Go to next message
Asha is currently offline AshaFriend
Messages: 18
Registered: July 2009
Junior Member
Hello,

I am getting following Null pointer exception while doing Save As
Functionality in my GMF application

java.lang.NullPointerException
at
com.bosch.rtc.flowVinci.diagram.part.FlowVinciDiagramEditor. performSaveAs(FlowVinciDiagramEditor.java:483)
at
com.bosch.rtc.flowVinci.diagram.part.FlowVinciDiagramEditor. doSaveAs(FlowVinciDiagramEditor.java:412)
at org.eclipse.ui.internal.SaveAsAction.run(SaveAsAction.java:6 2)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498 )
at
org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:545)
at
org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:490)
at
org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:402)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3682)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3293)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2389)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 19)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:289)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at
com.bosch.rtc.flowVinci.diagram.application.FlowVinciApplica tion.run(FlowVinciApplication.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.eclipse.equinox.internal.app.EclipseAppContainer.callMet hod(EclipseAppContainer.java:533)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:155)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 504)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443)
at org.eclipse.equinox.launcher.Main.run(Main.java:1169)
at org.eclipse.equinox.launcher.Main.main(Main.java:1144)


It is giving exception at
getDocumentProvider(newInput).saveDocument(progressMonitor,
newInput,
getDocumentProvider().getDocument(getEditorInput()), true);

When debugged the Null Pointer exception location was found at

public IDocumentProvider getDocumentProvider(String extension,
IDocumentProviderSelector selector) {

Set set= (Set) fExtensionMapping.get(extension);
if (set != null) {
IConfigurationElement entry = selectConfigurationElement(set, selector);
if(entry != null)
return getDocumentProvider(entry);
}
return null;
}

in DocumentProviderRegistry.class

Here set is null.

Any idea how to solve this..


Regards,
ASha
Re: Null Pointer exception while Save As [message #186628 is a reply to message #186608] Tue, 13 May 2008 11:42 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Asha,

Here is implementation of getDocumentProvider method generated for Ecore
diagram editor:

protected IDocumentProvider getDocumentProvider(IEditorInput input) {
if (input instanceof IFileEditorInput || input instanceof URIEditorInput) {
return EcoreDiagramEditorPlugin.getInstance().getDocumentProvider() ;
}
return super.getDocumentProvider(input);
}

In other words, if you are passing IFileEditorInput or URIEditorInput as
a parameter then proper document provider will be returned. Looks like you
have either different implementation of this method or using incorrect EditorInput..

-----------------
Alex Shatalin
Previous Topic:Adding entries to " Select All" Menu
Next Topic:Events to detect moving,drag and resize of editpart
Goto Forum:
  


Current Time: Fri Apr 26 19:36:58 GMT 2024

Powered by FUDForum. Page generated in 0.03199 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top