Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 326467 - NPE when removing an EAR reference with no archiveName attribute defined
Summary: NPE when removing an EAR reference with no archiveName attribute defined
Status: RESOLVED FIXED
Alias: None
Product: WTP Java EE Tools
Classification: WebTools
Component: jst.j2ee (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2.2 P   Edit
Assignee: Aidyl Kareh CLA
QA Contact: Chuck Bridgham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-28 17:09 EDT by Aidyl Kareh CLA
Modified: 2010-10-04 14:39 EDT (History)
3 users (show)

See Also:
cbridgha: review+
jsholl: review+


Attachments
Proposed Patch (2.92 KB, patch)
2010-09-28 17:11 EDT, Aidyl Kareh CLA
no flags Details | Diff
Updated Patch (2.93 KB, patch)
2010-09-29 10:46 EDT, Aidyl Kareh CLA
ccc: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Aidyl Kareh CLA 2010-09-28 17:09:14 EDT
Build Identifier: WTP 3.2.2

This bug is to get the fix into WTP 3.2.2 patches

+++ This bug was initially created as a clone of Bug #326458 +++

I got the following NPE when removing a project reference from the EAR using
the 'Deployment Assembly' properties page. The archiveName attribute had been
previously removed from the dependent-module element in the .component file.
The RemoveComponentFromEnterpriseApplicationOperation.updateEARDD() method
should not assume that the archiveName is not null.

java.lang.NullPointerException
    at org.eclipse.core.runtime.Path.<init>(Path.java:153)
    at
org.eclipse.jst.j2ee.application.internal.operations.RemoveComponentFromEnterpriseApplicationOperation$1.run(RemoveComponentFromEnterpriseApplicationOperation.java:102)
    at
org.eclipse.jst.jee.model.internal.JEE5ModelProvider.modify(JEE5ModelProvider.java:256)
    at
org.eclipse.jst.j2ee.application.internal.operations.RemoveComponentFromEnterpriseApplicationOperation.updateEARDD(RemoveComponentFromEnterpriseApplicationOperation.java:80)
    at
org.eclipse.jst.j2ee.application.internal.operations.RemoveComponentFromEnterpriseApplicationOperation.execute(RemoveComponentFromEnterpriseApplicationOperation.java:52)
    at
org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl$1.run(DataModelPausibleOperationImpl.java:385)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
    at
org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.runOperation(DataModelPausibleOperationImpl.java:410)
    at
org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.runOperation(DataModelPausibleOperationImpl.java:360)
    at
org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.doExecute(DataModelPausibleOperationImpl.java:247)
    at
org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.executeImpl(DataModelPausibleOperationImpl.java:219)
    at
org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.cacheThreadAndContinue(DataModelPausibleOperationImpl.java:89)
    at
org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.execute(DataModelPausibleOperationImpl.java:207)
    at
org.eclipse.wst.common.componentcore.ui.propertypage.AddModuleDependenciesPropertiesPage.removeOneReference(AddModuleDependenciesPropertiesPage.java:1075)
    at
org.eclipse.wst.common.componentcore.ui.propertypage.AddModuleDependenciesPropertiesPage.removeReferences(AddModuleDependenciesPropertiesPage.java:1068)
    at
org.eclipse.wst.common.componentcore.ui.propertypage.AddModuleDependenciesPropertiesPage$3.run(AddModuleDependenciesPropertiesPage.java:1054)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1957)
    at
org.eclipse.wst.common.componentcore.ui.propertypage.AddModuleDependenciesPropertiesPage.handleRemoved(AddModuleDependenciesPropertiesPage.java:1058)
    at
org.eclipse.jst.j2ee.internal.ui.preferences.EarModuleDependenciesPropertyPage.handleRemoved(EarModuleDependenciesPropertyPage.java:132)
    at
org.eclipse.wst.common.componentcore.ui.propertypage.AddModuleDependenciesPropertiesPage.saveReferenceChanges(AddModuleDependenciesPropertiesPage.java:1028)
    at
org.eclipse.wst.common.componentcore.ui.propertypage.AddModuleDependenciesPropertiesPage.performOk(AddModuleDependenciesPropertiesPage.java:940)
    at
org.eclipse.jst.j2ee.internal.ui.preferences.EarModuleDependenciesPropertyPage.performOk(EarModuleDependenciesPropertyPage.java:196)
    at
org.eclipse.wst.common.componentcore.ui.propertypage.ModuleAssemblyRootPage.performOk(ModuleAssemblyRootPage.java:74)
    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:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
    at java.lang.reflect.Method.invoke(Method.java:599)
    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)

Reproducible: Always
Comment 1 Aidyl Kareh CLA 2010-09-28 17:11:42 EDT
Created attachment 179793 [details]
Proposed Patch

Same patch as bug 326458.

Updated RemoveComponentFromEnterpriseApplicationOperation.updateEARDD() method
so that it avoids using the dependentObject if it has no id set. Also added
check to make sure the getArchiveName() method returned a non-null value before
using it to get the matching module.
Comment 2 Chuck Bridgham CLA 2010-09-29 10:18:48 EDT
approved - more junit coverage needed
Comment 3 Aidyl Kareh CLA 2010-09-29 10:46:00 EDT
Created attachment 179855 [details]
Updated Patch

Patch has been updated to replace using the <String>.isEmpty() method, which
is Java 6 specific, with a Java 5 equivalent.

Patch for bug 326458 was also updated.
Comment 4 Carl Anderson CLA 2010-10-04 14:39:12 EDT
Committed to R3_2_2_patches