Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 317306 - JAX-RS Property page- RuntimeException when <None> runtime targeted
Summary: JAX-RS Property page- RuntimeException when <None> runtime targeted
Status: RESOLVED FIXED
Alias: None
Product: WTP Webservices
Classification: WebTools
Component: jst.ws (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2.1   Edit
Assignee: Eric Peters CLA
QA Contact: Keith Chong CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-18 11:20 EDT by Eric Peters CLA
Modified: 2010-06-23 14:41 EDT (History)
0 users

See Also:
keith.chong.ca: review+


Attachments
patch (1.91 KB, patch)
2010-06-22 21:32 EDT, Eric Peters CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Peters CLA 2010-06-18 11:20:10 EDT
Steps to recreate:
1. create dynamic web project, target <None> runtime, add JAX-RS facet, and on the JAX-RS facet page select User Library (may need to define a user library)
2. Launch Property page on the project, select Project Facets > JAX-RS , Press OK

Exception below in .log and the library type has changed from User Library to "Legacy Library Configuration".


!ENTRY org.eclipse.jface 4 0 2010-06-18 11:11:56.671
!MESSAGE java.lang.RuntimeException: java.lang.IllegalArgumentException
!STACK 0
java.lang.RuntimeException: java.lang.IllegalArgumentException
	at org.eclipse.jst.common.project.facet.ui.libprov.LibraryFacetPropertyPage.performOk(LibraryFacetPropertyPage.java:422)
	at org.eclipse.jst.ws.jaxrs.ui.internal.project.facet.JAXRSLibraryPropertyPage.performOk(JAXRSLibraryPropertyPage.java:234)
	at org.eclipse.jface.preference.PreferenceDialog$13.run(PreferenceDialog.java:964)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
	at org.eclipse.jface.preference.PreferenceDialog.okPressed(PreferenceDialog.java:944)
	at org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog.okPressed(FilteredPreferenceDialog.java:447)
	at org.eclipse.jface.preference.PreferenceDialog.buttonPressed(PreferenceDialog.java:233)
	at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
	at org.eclipse.jface.window.Window.open(Window.java:801)
	at org.eclipse.ui.dialogs.PropertyDialogAction.run(PropertyDialogAction.java:157)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
	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:1053)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	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:369)
	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:48)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:600)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Caused by: java.lang.IllegalArgumentException
	at org.eclipse.wst.server.core.internal.facets.FacetUtil.getRuntime(FacetUtil.java:64)
	at org.eclipse.jst.server.core.FacetUtil.getRuntime(FacetUtil.java:47)
	at org.eclipse.jst.ws.jaxrs.core.internal.project.facet.JAXRSUserLibraryProviderInstallOperation.execute(JAXRSUserLibraryProviderInstallOperation.java:62)
	at org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate.execute(LibraryInstallDelegate.java:580)
	at org.eclipse.jst.common.project.facet.ui.libprov.LibraryFacetPropertyPage.performOkInternal(LibraryFacetPropertyPage.java:435)
	at org.eclipse.jst.common.project.facet.ui.libprov.LibraryFacetPropertyPage.access$1(LibraryFacetPropertyPage.java:428)
	at org.eclipse.jst.common.project.facet.ui.libprov.LibraryFacetPropertyPage$5.run(LibraryFacetPropertyPage.java:388)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
	at org.eclipse.jst.common.project.facet.ui.libprov.LibraryFacetPropertyPage$6.run(LibraryFacetPropertyPage.java:402)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Comment 1 Eric Peters CLA 2010-06-18 11:21:42 EDT
Investigating a very safe fix for 3.2.1, otherwise will retarget to 3.3.
Comment 2 Eric Peters CLA 2010-06-22 21:32:10 EDT
Created attachment 172476 [details]
patch

Very safe fix (guard against NPE).
Comment 3 Eric Peters CLA 2010-06-22 22:16:59 EDT
Hi Keith, please review/approve patch and if it is OK I will commit to 3.2.1.

Thanks,
Comment 4 Keith Chong CLA 2010-06-23 12:13:46 EDT
Hi Eric,
 
Looks good.  In JAXRSFacetInstallPage, at line 255-256, we do already check for a null runtime.

Can you check if other places in the jax-rs plugins do this check?

Other than the source formatting, looks good, Eric.
Comment 5 Eric Peters CLA 2010-06-23 14:41:41 EDT
Fix released to 3.2.1 & HEAD. 

Looks like we are checking for null runtime everywhere we need to.