Bug 18305 - NPE from runtime workbench launch config
Summary: NPE from runtime workbench launch config
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: PC Linux-GTK
: P1 normal (vote)
Target Milestone: 2.0 F3   Edit
Assignee: Dejan Glozic CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-05-30 09:37 EDT by Jared Burns CLA
Modified: 2002-06-06 09:45 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jared Burns CLA 2002-05-30 09:37:47 EDT
Build 20020529

I'm running a workspace that was created on WinXP on Linux. The workspace 
contains a runtime workbench launch configuration. When I try to bring up 
the launch configuration dialog, the following NPE occurs:

!MESSAGE java.lang.NullPointerException
!STACK 0
java.lang.NullPointerException
	at 
org.eclipse.pde.internal.ui.launcher.BasicLauncherTab.performApply(BasicLauncherTab.java:281)
	at 
org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup.performApply(AbstractLaunchConfigurationTabGroup.java:90)
	at 
org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationDialog.updateWorkingCopyFromPages(LaunchConfigurationDialog.java:2110)
	at 
org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationDialog.isWorkingCopyDirty(LaunchConfigurationDialog.java:1545)
	at 
org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationDialog.updateButtons(LaunchConfigurationDialog.java:2556)
	at 
org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationDialog.refreshStatus(LaunchConfigurationDialog.java:778)
	at 
org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationDialog.setLaunchConfiguration(LaunchConfigurationDialog.java:1398)
	at 
org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationDialog.selectionChanged(LaunchConfigurationDialog.java:1319)
	at 
org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:147)
	at 
org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:1153)
	at 
org.eclipse.jface.viewers.StructuredViewer.setSelection(StructuredViewer.java:903)
	at org.eclipse.jface.viewers.Viewer.setSelection(Viewer.java:342)
	at 
org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationDialog.doInitialTreeSelection(LaunchConfigurationDialog.java:478)
	at 
org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationDialog.createContents(LaunchConfigurationDialog.java:428)
	at org.eclipse.jface.window.Window.create(Window.java:278)
	at org.eclipse.jface.window.Window.open(Window.java:527)
	at 
org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationDialog.doLastLaunchedConfig(LaunchConfigurationDialog.java:558)
	at 
org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationDialog.open(LaunchConfigurationDialog.java:519)
	at 
org.eclipse.debug.internal.ui.actions.OpenLaunchConfigurationsAction.run(OpenLaunchConfigurationsAction.java:133)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:749)
	at 
org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:407)
	at 
org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent(ActionContributionItem.java:361)
	at 
org.eclipse.jface.action.ActionContributionItem.access$0(ActionContributionItem.java:352)
	at 
org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent(ActionContributionItem.java:47)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:75)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:804)
	at 
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1380)
	at 
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1224)
	at 
org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1095)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:1078)
	at 
org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:739)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462)
	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:324)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:200)
	at org.eclipse.core.launcher.Main.run(Main.java:643)
	at org.eclipse.core.launcher.Main.main(Main.java:476)
Comment 1 Dejan Glozic CLA 2002-05-30 12:07:10 EDT
Launch configurations are not portable and cannot be reused between operating 
systems. There are several attributes that just cannot be portable. For 
example, the JVM to use to run only applies to the machine on which it was 
detected. Workspace is also machine-specific. 

It is possible to do something about it, but we will have to do it on a post-
2.0 time frame.
Comment 2 Jared Burns CLA 2002-05-30 12:13:52 EDT
Have you added a fix for the NPE? You can't make Eclipse workspaces 
non-portable.
Comment 3 Jared Burns CLA 2002-06-03 10:44:16 EDT
Please see above comment. Also, note that this is not purely a cross-platform
issue. This bug also prevents sharing of workspaces across different machines on
the same platform.

This is a major problem which can impede Eclipse development.
Comment 4 Dejan Glozic CLA 2002-06-03 11:00:02 EDT
The statement is not true. You can still share your workspace. What you need to 
do is not share the launch configuration i.e. go to the common tab and mark it 
as local (not shared). Workspace data (plug-ins, fragments) have nothing to do 
with workspace metadata (in this case, stored launch configuration). I don't 
see how sharing launch configuration (which has a fairly reasonable default 
values and does not have many controls anyway) is a critical issue. Just create 
a new (local) configuration - it will pick up the correct platform-specific 
data.

I reaffirm the original decision not to fix this in 2.0. You can take it up to 
eclipse.org for voting if you want.
Comment 5 Jared Burns CLA 2002-06-03 11:45:43 EDT
The issue is with LOCAL launch configurations, not shared configs.
Comment 6 Jared Burns CLA 2002-06-03 15:18:48 EDT
Steps:
Machine 1
Host - C:\Eclipse20020602
Data - C:\Eclipse
VM - C:\Java\jdk1.4.1_b11\bin\java.exe

Machine 2
Host - C:\Eclipse20020602\eclipse
Data - C:\workspaces\eclipse
VM - C:\jdk1.3.1\bin\java.exe

1. Launch Eclipse on Machine 1 as specified (new workspace).
2. Import org.eclipse.ui and all required plugins as binary.
3. Open the Java perspective.
4. Pull down the chevron on the debug button, choose "Debug As...->Runtime 
workbench"
5. When the target Eclipse finishes loading, close it. Also close the host.
6. Set up Machine 2 as indicated, using the workspace from Machine 1.
7. Launch Eclipse on Machine 2 as specified (with workspace from M1).
8. Open the Java perspective.
9. Pull down the chevrom on the debug button, choose "Debug..." The dialog 
fails to realize. A NullPointerException is written to the log.

On the current code base (20020602), the NPE now occurs 
here:org.eclipse.pde.internal.ui.launcher.BasicLauncherTab.performApply
(BasicLauncherTab.java:296)
Comment 7 John Wiegand CLA 2002-06-03 15:29:51 EDT
This NPE is worth fixing.  The Launch Configuration Dialog will never come up 
if this isn't fixed.   This weeks an innocent workspace (no shared launch 
configurations) from being able to run or debug any further programs.

All pde needs to do is protect against a missing VMInstall -this looks like a 
very modest edit - 1-2 lines.

As additional protection, the launch configuration support should consider 
wrapping this failure case with an exception handler as well - to catch the 
problem creating this and reporting the error.  I will open a new defect report 
for this.
Comment 8 Dejan Glozic CLA 2002-06-03 15:43:18 EDT
Agreed that the particular NPE should be fixed. My point was that PDE should 
not try to be super helpful by trying to reconcile configurations that clearly 
contain data that cannot be moved between machines (e.g. location of the 
workspace, the particular JVM to use etc.). 
Comment 9 Jared Burns CLA 2002-06-03 15:43:58 EDT
I actually opened a bug report for that right after I opened this one: 
Bug 18306 - Launch configuration dialog is vulnerable to all delegates
Comment 10 Dejan Glozic CLA 2002-06-04 18:55:52 EDT
F3 candidate.
Comment 11 Dejan Glozic CLA 2002-06-06 09:45:05 EDT
Fixed the NPE.