Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 373431

Summary: IllegalArgumentException when trying to delete a Server from server definitions
Product: [WebTools] WTP ServerTools Reporter: Elson Yuen <eyuen7>
Component: wst.serverAssignee: Steven Hung <sghung>
Status: RESOLVED FIXED QA Contact: Elson Yuen <eyuen7>
Severity: normal    
Priority: P3 CC: sghung
Version: 3.3Flags: eyuen7: review+
Target Milestone: 3.3.2 P   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on: 371828    
Bug Blocks:    
Attachments:
Description Flags
Patch 1.0 none

Description Elson Yuen CLA 2012-03-06 16:18:57 EST
+++ This bug was initially created as a clone of Bug #371828 +++

Build Identifier: WTP 3.2.5 patches

When a server adapter is added to the server view on Eclipse startup, if the user goes to the server view, right clicks on the server (Note: if you left click on the server, this issue will not occur), and selects delete, the following error is thrown:

java.lang.IllegalArgumentException
	at org.eclipse.wst.server.ui.internal.DeleteServerDialog.<init>(Unknown Source)
	at org.eclipse.wst.server.ui.internal.view.servers.GlobalDeleteAction.deleteServer(Unknown Source)
	at org.eclipse.wst.server.ui.internal.view.servers.GlobalDeleteAction.run(Unknown Source)
	at org.eclipse.jface.action.Action.runWithEvent(Unknown Source)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(Unknown Source)
	at org.eclipse.jface.action.ActionContributionItem.access$2(Unknown Source)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(Unknown Source)
	at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
	at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Unknown Source)
	at org.eclipse.ui.internal.Workbench.runUI(Unknown Source)
	at org.eclipse.ui.internal.Workbench.access$4(Unknown Source)
	at org.eclipse.ui.internal.Workbench$7.run(Unknown Source)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Unknown Source)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Unknown Source)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(Unknown Source)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(Unknown Source)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Unknown Source)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(Unknown Source)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(Unknown Source)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(Unknown Source)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(Unknown Source)
	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(Unknown Source)
	at org.eclipse.equinox.launcher.Main.basicRun(Unknown Source)
	at org.eclipse.equinox.launcher.Main.run(Unknown Source)
	at org.eclipse.equinox.launcher.Main.main(Unknown Source)


This issue is caused by the servers to delete not being populated in org.eclipse.wst.server.ui.internal.view.servers.GlobalDeleteAction because there was no selection change.

Reproducible: Always
Comment 1 Elson Yuen CLA 2012-03-06 16:19:59 EST
This defect is to port changes on bug 371828 to 3.3.2 patch stream.
Comment 2 Steven Hung CLA 2012-03-06 17:52:20 EST
Created attachment 212175 [details]
Patch 1.0

Ported change to R3_3_maintenance and ran testing as described below.

org.eclipse.wst.server.ui.internal.view.servers.GlobalDeleteAction.deleteServer(IServer)
will check to see if the server to delete is null. If it is, it will call
org.eclipse.wst.server.ui.internal.view.servers.GlobalDeleteAction.selectionChanged(IStructuredSelection)
to populate the server variable. This extra check ensures that even if no
selectionChanged event has occurred, that the server to delete will still be
initialized. 

Tests run:
1. Have a server adapter which automatically adds server to server view, right
click on the server to delete, and ensure a delete works without any errors and
actually deletes from view (the original reported issue)
2. Have a server adapter which automatically adds server to the server view,
left click on the server to get focus, right click on the server to delete, and
ensure a delete works without any errors and actually deletes from view
3. Launch a workspace where a server is not added automatically, add a new
Tomcat server, right click to delete, and ensure deletion of both servers works
without any errors and are removed from the view
4. Launch a workspace where two servers already exist, right click on both
servers, right click to delete, and ensure deletion of both servers works
without any errors and are removed from the view
5. Use the delete key instead of right click for tests 1-2, ensure deletion
occurs without any errors and are removed from the view
Comment 3 Elson Yuen CLA 2012-03-07 11:33:58 EST
Code changes is fine.
Comment 4 Elson Yuen CLA 2012-04-03 10:13:34 EDT
Changes released to 332P on 20120307