[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] NPE at BaseSharedObject#destroySelfLocal

Hi Cynipe,

cynipe wrote:
> Hi, all!
>
> I'm using SharedObject API and trying to send destroy message to other
> clients before disconnecting container, since there is some process to
> do. so think it's better to use destorySelfLocal. but, I got NPE when I
> invoke that.
>
> so, question is here, isn't is always happen after invoking
> "manager.removeSharedObject(getID());"?
> or, there is any goodway to call destroySelfLocal?
>   

This is a bug, as it's getting the NPE inside the trace call. Please
report this to bugs.eclipse.org and we'll use that to trace the problem.

The destroySelfLocal can be safely called when the shared object
actually exists inside the container. If some other thread has
(previously) removed the shared object from the container and then
destroySelfLocal is called (i.e. by your thread), then destroySelfLocal
should do nothing (rather the NPE you are seeing is a bug in the
BaseSharedObject trace impl.

Thanks,

Scott

> ECF version is 2.0.1.v20080916-1301.
>
> thanks,
> Cynipe
>
> ----BaseSharedObject---
> 	protected void destroySelfLocal() {
> 		traceEntering("destroySelfLocal"); //$NON-NLS-1$
> 		try {
> 			ISharedObjectManager manager = getContext().getSharedObjectManager();
> 			if (manager != null) {
> 				manager.removeSharedObject(getID());
> 			}
> 		} catch (Exception e) {
> 			traceCatching("destroySelfLocal", e); //$NON-NLS-1$
> 			log(DESTROYSELFLOCAL_CODE, "destroySelfLocal", e); //$NON-NLS-1$
> 		}
> 		traceExiting("destroySelfLocal"); //$NON-NLS-1$
> 	}
> ----
>
> ----stacktrace----
> java.lang.NullPointerException
> 	at
> org.eclipse.ecf.core.sharedobject.BaseSharedObject.getLocalContainerID(BaseSharedObject.java:240)
> 	at
> org.eclipse.ecf.core.sharedobject.BaseSharedObject.isPrimary(BaseSharedObject.java:263)
> 	at
> org.eclipse.ecf.core.sharedobject.BaseSharedObject.getSharedObjectAsString(BaseSharedObject.java:593)
> 	at
> org.eclipse.ecf.core.sharedobject.BaseSharedObject.traceEntering(BaseSharedObject.java:599)
> 	at
> org.eclipse.ecf.core.sharedobject.BaseSharedObject.destroySelf(BaseSharedObject.java:284)
> 	at XXXX(XXXX.java:239)
> 	at XXXX(XXXX.java:157)
> 	at XXXX(TXXX.java:189)
> 	at XXXX(XXXX.java:65)
> 	at XXXX(XXXX.java:78)
> 	at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
> 	at
> org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:583)
> 	at
> org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:500)
> 	at
> org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:452)
> 	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
> 	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3823)
> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422)
> 	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382)
> 	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
> 	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198)
> 	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
> 	at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
> 	at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488)
> 	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
> 	at
> org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
> 	at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
> 	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:386)
> 	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:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
> 	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
> 	at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
> 	at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
> _______________________________________________
> ecf-dev mailing list
> ecf-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/ecf-dev
>