Bug 277623 - NPE in org.eclipse.uml2.uml.editor.presentation.UMLModelWizard.performFinish
Summary: NPE in org.eclipse.uml2.uml.editor.presentation.UMLModelWizard.performFinish
Status: RESOLVED WORKSFORME
Alias: None
Product: MDT.UML2
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal with 1 vote (vote)
Target Milestone: M6   Edit
Assignee: James Bruck CLA
QA Contact:
URL:
Whiteboard: Community Support
Keywords: plan
Depends on: 308241
Blocks:
  Show dependency tree
 
Reported: 2009-05-24 21:55 EDT by Nicolas Rouquette CLA
Modified: 2010-05-28 14:59 EDT (History)
4 users (show)

See Also:


Attachments
Patch to force a refresh between the workspace modify operation & opening the editor (795 bytes, patch)
2009-05-24 23:03 EDT, Nicolas Rouquette CLA
no flags Details | Diff
mylyn/context/zip (3.70 KB, application/octet-stream)
2009-05-24 23:03 EDT, Nicolas Rouquette CLA
no flags Details
Patch for UMLModelWizard (1.61 KB, patch)
2010-04-07 05:04 EDT, Laurent Goubet CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Rouquette CLA 2009-05-24 21:55:08 EDT
With Galileo M7 build, I sometimes get NPE here:

java.lang.NullPointerException
	at org.eclipse.uml2.uml.editor.presentation.UMLModelWizard.performFinish(UMLModelWizard.java:326)
	at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:752)
	at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:373)
	at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:228)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3880)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3473)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
	at org.eclipse.jface.window.Window.open(Window.java:801)
	at org.eclipse.ui.internal.handlers.WizardHandler$New.executeHandler(WizardHandler.java:253)
	at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:273)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:294)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
	at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
	at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:157)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3880)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3473)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	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:559)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
	
The UMLModelWizard.performFinish() method assumes the 'modelFile' has been created as a consequence of the WorkspaceModifyOperation invoked a few lines above:

			try {
				page.openEditor(new FileEditorInput(modelFile), workbench
					.getEditorRegistry().getDefaultEditor(
						modelFile.getFullPath().toString()).getId());  // line 326
			}
			
There seems to be a missing resource refresh operation after the WorkspaceModifyOperation which creates the 'modelFile' resource and opening an editor on that (new) resource.
Comment 1 Nicolas Rouquette CLA 2009-05-24 23:03:00 EDT
Created attachment 136939 [details]
Patch to force a refresh between the workspace modify operation & opening the editor
Comment 2 Nicolas Rouquette CLA 2009-05-24 23:03:04 EDT
Created attachment 136940 [details]
mylyn/context/zip
Comment 3 Nicolas Rouquette CLA 2009-05-26 04:52:11 EDT
Can someone test the following procedure to replicate this bug?

1) Open an existing *.uml file in a workspace folder => the UMLEditor opens.
2) In the same workspace folder | File | New => UML File => give some name

=> NPE with the stack trace provided above.
Comment 4 James Bruck CLA 2009-06-16 10:57:04 EDT
Nicolas,  
Sorry about the delay in getting back on this one.   I've tried this out with the latest RC5 and cannot seem to reproduce the error.   Could there be something else in your environment that could be triggering the problem?
Could there be a step missing?  Can you try with a clean environment (just UML2 and EMF).

- James.
Comment 5 Nicolas Rouquette CLA 2009-06-16 17:05:42 EDT
I installed Galileo RC4 which includes UML2 3.0.0 RC5.
Still the same error:

java.lang.NullPointerException
	at org.eclipse.uml2.uml.editor.presentation.UMLModelWizard.performFinish(UMLModelWizard.java:326)
	at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:752)
	at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:373)
	at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:228)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3542)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1247)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1270)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1255)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1076)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3440)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3099)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
	at org.eclipse.jface.window.Window.open(Window.java:801)
	at org.eclipse.ui.internal.handlers.WizardHandler$New.executeHandler(WizardHandler.java:253)
	at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:273)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:294)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
	at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
	at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:157)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3542)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1247)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1270)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1255)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1076)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3440)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3099)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
Comment 6 Kenn Hussey CLA 2009-07-10 18:41:21 EDT
(In reply to comment #3)
> Can someone test the following procedure to replicate this bug?
> 
> 1) Open an existing *.uml file in a workspace folder => the UMLEditor opens.
> 2) In the same workspace folder | File | New => UML File => give some name
> 
> => NPE with the stack trace provided above.

I've been able to reproduce this in the released Galileo Modeling package using the above steps. It does not, however, happen in a runtime workspace.
Comment 7 Nicolas Rouquette CLA 2009-09-02 12:12:13 EDT
Kenn,

With Galileo build 20090621-0832, do File | New => UML File => specify a name, then click OK.
The dialog stays open.
I get a warning:

java.lang.NullPointerException
at org.eclipse.uml2.uml.editor.presentation.UMLModelWizard.performFinish(UMLModelWizard.java:326)
at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:752)
at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:373)
at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:228)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3542)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1247)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1270)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1255)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1076)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3440)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3099)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
at org.eclipse.jface.window.Window.open(Window.java:801)
at org.eclipse.ui.internal.handlers.WizardHandler$New.executeHandler(WizardHandler.java:253)
at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:273)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:294)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:157)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3542)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1247)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1270)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1255)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1076)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3440)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3099)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
at org.eclipse.jface.window.Window.open(Window.java:801)
at org.eclipse.ui.internal.views.log.EventDetailsDialog.open(EventDetailsDialog.java:175)
at org.eclipse.ui.internal.views.log.EventDetailsDialogAction.run(EventDetailsDialogAction.java:98)
at org.eclipse.ui.internal.views.log.LogView$15.doubleClick(LogView.java:533)
at org.eclipse.jface.viewers.StructuredViewer$1.run(StructuredViewer.java:821)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.runtime.Platform.run(Platform.java:888)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
at org.eclipse.jface.viewers.StructuredViewer.fireDoubleClick(StructuredViewer.java:819)
at org.eclipse.jface.viewers.AbstractTreeViewer.handleDoubleSelect(AbstractTreeViewer.java:1419)
at org.eclipse.jface.viewers.StructuredViewer$4.widgetDefaultSelected(StructuredViewer.java:1195)
at org.eclipse.jface.util.OpenStrategy.fireDefaultSelectionEvent(OpenStrategy.java:238)
at org.eclipse.jface.util.OpenStrategy.access$0(OpenStrategy.java:235)
at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:296)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3542)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1247)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1270)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1255)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1076)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3440)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3099)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
Comment 8 Kenn Hussey CLA 2010-03-24 02:05:59 EDT
*** Bug 306888 has been marked as a duplicate of this bug. ***
Comment 9 Kenn Hussey CLA 2010-04-06 13:29:50 EDT
This bug is most likely due to the fact that EMF Compare registers a content type for *.uml resources. I've opened bug 308241 against EMF Compare for that.
Comment 10 Laurent Goubet CLA 2010-04-07 05:04:41 EDT
Created attachment 164012 [details]
Patch for UMLModelWizard

Double clicking an uml file in the workspace opens the UML editor as intended even when we register ".uml" against another content type (EMF Compare is but an example of this, yet the wizard does not. The attached patch will make the wizard retrieve the same editor as does a double click in the IDE.

I believe a null check should be added as was done in the other wizards (take a look at line 320 of EcoreModelWizard for example) to avoid the case where even the IDE doesn't manage to retrieve the editor properly, yet I didn't do it in this patch.
Comment 11 Kenn Hussey CLA 2010-04-14 18:04:21 EDT
The patch Laurent attached cannot be applied... against which stream was this patch produced?

The current code for the UML model wizard already opens the same editor as double-click does, as far as I can tell. In fact, the code is quite similar to that suggested by Laurent. So, I'm not sure anything needs to be changed after all. In fact, I just downloaded the Helios M6 Modeling package and could not reproduce the problem (although I did find a new problem that appears to affect all EMF-based wizards - I'll open a new bug for that one).

Stephan, did you try this using the latest bits? At this point, I'm inclined to resolve this as WORKSFORME.
Comment 12 Stephan Eberle CLA 2010-04-15 04:38:17 EDT
(In reply to comment #11)
> Stephan, did you try this using the latest bits? At this point, I'm inclined to
> resolve this as WORKSFORME.

I've observed the problem under Galileo, i.e., Eclipse 3.5.2. I haven't tested the same scenario under Helios yet but could do that once we start supporting Helios as target platform (which will be something like mid of May 2010). Could we simply leave this bug open till then?
Comment 13 Kenn Hussey CLA 2010-04-15 09:21:03 EDT
I'd rather resolve it for now and reopen it if/when you are able to provide a scenario (using a recent Helios build) that demonstrates the problem.
Comment 14 Kenn Hussey CLA 2010-04-15 13:09:14 EDT
(In reply to comment #11)
> The patch Laurent attached cannot be applied... against which stream was this
> patch produced?
> 
> The current code for the UML model wizard already opens the same editor as
> double-click does, as far as I can tell. In fact, the code is quite similar to
> that suggested by Laurent. So, I'm not sure anything needs to be changed after
> all. In fact, I just downloaded the Helios M6 Modeling package and could not
> reproduce the problem (although I did find a new problem that appears to affect
> all EMF-based wizards - I'll open a new bug for that one).

See bug 309350 for the new issue.