Bug 170601 - [Workbench] NPE in Workbench when restarting RCP while initializing
Summary: [Workbench] NPE in Workbench when restarting RCP while initializing
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2007-01-16 05:30 EST by Mike Haller CLA
Modified: 2019-09-06 16:18 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Haller CLA 2007-01-16 05:30:19 EST
Build ID: M20060921-0945

Steps To Reproduce:
1. Create an RCP app with a PlatformRunnable
2. Use PlatformUI.getWorkbench().restart() within the PlatformRunnable, before the event dispatcher is started




More information:
The workbench should check its state and throw an IllegalArgumentException or alike, not NPE.

!ENTRY org.eclipse.ui.workbench 4 2 2007-01-16 10:30:14.632
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.ui.workbench".
!STACK 0
java.lang.NullPointerException
at org.eclipse.ui.internal.Workbench.getWorkbenchWindows(Workbench.java:1009)
at org.eclipse.ui.internal.Workbench$13.run(Workbench.java:740)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.ui.internal.Workbench.saveAllEditors(Workbench.java:735)
at org.eclipse.ui.internal.Workbench.busyClose(Workbench.java:655)
at org.eclipse.ui.internal.Workbench.access$8(Workbench.java:639)
at org.eclipse.ui.internal.Workbench$14.run(Workbench.java:839)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
at org.eclipse.ui.internal.Workbench.close(Workbench.java:837)
at org.eclipse.ui.internal.Workbench.restart(Workbench.java:1644)
Comment 1 Tod Creasey CLA 2007-04-13 10:57:15 EDT
Can you give more details please?

Where did you call the restart? Is it in your activator code somewhere?

Which event dispatcher are you referring to?
Comment 2 Mike Haller CLA 2007-04-14 04:41:19 EDT
/* (non-Javadoc)
	 * @see org.eclipse.core.runtime.IPlatformRunnable#run(java.lang.Object)
	 */
	public Object run(Object args) throws Exception {
		Display display = PlatformUI.createDisplay();
		
		// Bug 170601: Leads to NPE
		Job job = new Job("Foo") {
			@Override
			protected IStatus run(IProgressMonitor monitor) {
				Display.getDefault().asyncExec(new Runnable(){
					public void run() {
						PlatformUI.getWorkbench().restart();
					}});
				return Status.OK_STATUS;
			}
		};
		job.schedule();
		
		try {
			int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
			if (returnCode == PlatformUI.RETURN_RESTART) {
				return IPlatformRunnable.EXIT_RESTART;
			}
			return IPlatformRunnable.EXIT_OK;
		} finally {
			display.dispose();
		}
	}
Comment 3 Eclipse Webmaster CLA 2019-09-06 16:18:20 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.