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

Bug 259075

Summary: Nullpointer Whilde working with GEF
Product: [Tools] GEF Reporter: Srinivasa Reddy Challa <challa.srinivasareddy>
Component: GEF-Legacy GEF (MVC)Assignee: Anthony Hunter <ahunter.eclipse>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ahunter.eclipse, Michael_Rennie
Version: 3.4   
Target Milestone: 3.5.0 (Galileo) M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Srinivasa Reddy Challa CLA 2008-12-17 04:41:46 EST
Build ID: 1.6.1.v20080919-1135

Steps To Reproduce:
1. I am using some other tooling over GEF and due to some 
reason this NulLpointer exception was been thrown and once it happens it happens consistently. 

But NullPointer exceptions should be easy to figure out


More information:

java.lang.NullPointerException
at org.eclipse.gef.requests.CreateRequest.getNewObject(CreateRequest.java:73)
at org.eclipse.gef.dnd.TemplateTransferDropTargetListener.selectAddedObject(TemplateTransferDropTargetListener.java:106)
at org.eclipse.gef.dnd.TemplateTransferDropTargetListener.handleDrop(TemplateTransferDropTargetListener.java:102)
at org.eclipse.gef.dnd.AbstractTransferDropTargetListener.drop(AbstractTransferDropTargetListener.java:171)
at org.eclipse.jface.util.DelegatingDropAdapter$3.run(DelegatingDropAdapter.java:211)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.runtime.Platform.run(Platform.java:880)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
at org.eclipse.jface.util.DelegatingDropAdapter.drop(DelegatingDropAdapter.java:209)
at org.eclipse.swt.dnd.DNDListener.handleEvent(DNDListener.java:90)
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.Widget.sendEvent(Widget.java:1027)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:770)
at org.eclipse.swt.dnd.DropTarget.Drop(DropTarget.java:455)
at org.eclipse.swt.dnd.DropTarget$3.method6(DropTarget.java:257)
at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:119)
at org.eclipse.swt.internal.ole.win32.COM.DoDragDrop(Native Method)
at org.eclipse.swt.dnd.DragSource.drag(DragSource.java:362)
at org.eclipse.swt.dnd.DragSource.access$0(DragSource.java:288)
at org.eclipse.swt.dnd.DragSource$1.handleEvent(DragSource.java:171)
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)
Comment 1 Anthony Hunter CLA 2008-12-17 14:40:54 EST
(In reply to comment #0)
> 
> But NullPointer exceptions should be easy to figure out
> 

Please provide the exact steps to reproduce the exception. I need it reproduced in an example to debug the problem.

Looks to me like the NPE is in your CreateRequest command, rather than GEF. The drop is asking for the new object and you are returning null.
Comment 2 Srinivasa Reddy Challa CLA 2008-12-26 00:54:37 EST
Hi Anthony,

I using some free tool that works with GEF, i am not sure of coding of the free tool.

From your API point of view you can check for the Null argument and thow InvalidArgumetnException with proper exception message and close the BUG

Thanks
Challa
Comment 3 Anthony Hunter CLA 2009-01-09 12:39:24 EST
OK, added the requested code:

	if (getFactory() == null) {
		throw new IllegalArgumentException(
		"CreateRequest has unspecified CreationFactory"); //$NON-NLS-1$
	}

Committed to HEAD