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

Bug 282363

Summary: thumbnail outline of gef will throw null point exception in certain condition
Product: [Tools] GEF Reporter: Ben Xu <xufengbing>
Component: GEF-Legacy GEF (MVC)Assignee: Anthony Hunter <ahunter.eclipse>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ahunter.eclipse
Version: 3.5   
Target Milestone: 3.6.0 (Helios) M4   
Hardware: PC   
OS: Linux-GTK   
Whiteboard:
Attachments:
Description Flags
ShapesEditor.java
none
test.shapes
none
outline1.gif
none
outline2.gif none

Description Ben Xu CLA 2009-07-03 05:58:43 EDT
Build ID: I20090611-1540

Steps To Reproduce:

1. install gef sdk with example and source for eclipse 3.5 release

2. create the standard GEF shapes example plugin project (file -new - examples- GEF(...)plugins-shapes  )

3. change the org.eclipse.gef.examples.shapes.ShapesEditor.java
withe attached ShapesEditor.java. (the only difaference between them is the attached one used a different outlineview using "ScrollableThumbnail". )

3.run as eclipse app. 

4. in the started runtime eclipse ,open outline view, error log view and   open the attached "test.shapes" file.(this file contains only a big rectangle)

5.decrease the outline height  by mouse drag drop on outline view edge.(see attached figure form outline1.gif to outline2.gif )

6. exception will throw in error log view with the following information.
org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NullPointerException)
at org.eclipse.swt.SWT.error(SWT.java:3884)
at org.eclipse.swt.SWT.error(SWT.java:3799)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:137)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3468)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3115)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
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:194)
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:368)
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:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
Caused by: java.lang.NullPointerException
at org.eclipse.draw2d.parts.Thumbnail$ThumbnailUpdater.run(Thumbnail.java:156)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
... 23 more



More information:
reproduced on on linux GTK for gef 3.5 with the latest galileo release.
Comment 1 Ben Xu CLA 2009-07-03 05:59:22 EDT
Created attachment 140758 [details]
ShapesEditor.java
Comment 2 Ben Xu CLA 2009-07-03 06:00:05 EDT
Created attachment 140759 [details]
test.shapes
Comment 3 Ben Xu CLA 2009-07-03 06:03:07 EDT
Created attachment 140760 [details]
outline1.gif
Comment 4 Ben Xu CLA 2009-07-03 06:03:55 EDT
Created attachment 140761 [details]
outline2.gif
Comment 5 Ben Xu CLA 2009-07-06 08:35:38 EDT
this bug appears since GEF on eclipse 3.3.2.
And if manually check the "thumbnailGraphics" in the following method by add

if(thumbnailGraphics==null){
return;
}

in the begin of org.eclipse.draw2d.parts.Thumbnail$ThumbnailUpdater.run()

the error message will gone. 

it's the simplest way to "fix" it. 

Comment 6 Anthony Hunter CLA 2009-12-10 13:17:59 EST
(In reply to comment #5)
> this bug appears since GEF on eclipse 3.3.2.
> And if manually check the "thumbnailGraphics" in the following method by add
> 
> if(thumbnailGraphics==null){
> return;
> }
> 
> in the begin of org.eclipse.draw2d.parts.Thumbnail$ThumbnailUpdater.run()
> 
> the error message will gone. 
> 
> it's the simplest way to "fix" it.

Made this minor fix in HEAD for 3.6.0.