This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 372956 - [Decorators] [JFace] CompositeImageDescriptor throws NPE during Decoration
Summary: [Decorators] [JFace] CompositeImageDescriptor throws NPE during Decoration
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7.1   Edit
Hardware: PC All
: P3 critical with 1 vote (vote)
Target Milestone: 4.4 M3   Edit
Assignee: Wojciech Sudol CLA
QA Contact: Wojciech Sudol CLA
URL:
Whiteboard:
Keywords:
: 405855 (view as bug list)
Depends on:
Blocks: 401276
  Show dependency tree
 
Reported: 2012-03-01 05:37 EST by Achim Loerke CLA
Modified: 2016-11-29 09:16 EST (History)
5 users (show)

See Also:


Attachments
Strack trace (5.57 KB, text/plain)
2012-03-01 05:37 EST, Achim Loerke CLA
no flags Details
Error that co-occurs with first reported error (3.24 KB, text/plain)
2012-03-08 02:52 EST, Alexandra Schladebeck CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Achim Loerke CLA 2012-03-01 05:37:55 EST
Created attachment 211866 [details]
Strack trace

Occasionally CompositeImageDescriptor throws a Null Pointer Exception while a View is decorated. Unfortunately we can find no pattern when this happens. When suppressing the NPE the decoration often (but not always) shows the missing icon instead of the decorated icon.

We've checked for quota/disk full problems, wrong bundles, etc. This happens on freshly installed applications on clean test instances, on versions installed month ago and every combination (but luckily not very often).

Attached is a stack trace from a recent NPE.
Comment 1 Remy Suen CLA 2012-03-01 08:21:18 EST
Well, getImageData() does say null is a valid return value so we should probably guard against this.
Comment 2 Alexandra Schladebeck CLA 2012-03-08 02:51:56 EST
There is also another (different) error that co-occurs with the first one reported. 

If the NPE is thrown when a view is decorated, then opening one of our wizards will also cause an error. The reverse is true as well - if I get an error in this wizard, then I'll get the errors when decorating views as well.

The error that occurs when opening the wizard is attached. Perhaps the additional information will be useful.
Comment 3 Alexandra Schladebeck CLA 2012-03-08 02:52:22 EST
Created attachment 212277 [details]
Error that co-occurs with first reported error
Comment 4 Alexandra Schladebeck CLA 2013-04-24 09:21:02 EDT
*** Bug 405855 has been marked as a duplicate of this bug. ***
Comment 5 Wojciech Sudol CLA 2013-09-26 08:45:36 EDT
As Remy mentioned, getImageData() can return null, so I added simple check to CompositeImageDescriptor.drawImage().
Probably there are another bugs behind the problems reported by Achim and Alexandra, but the stack traces are not enough to locate them.

Review URL: https://git.eclipse.org/r/#/c/16795/
Comment 7 Wojciech Sudol CLA 2013-10-29 10:03:56 EDT
Verified in I20131028-2000.
Comment 8 Markus Keller CLA 2016-11-29 09:16:55 EST
The "fix" was a hack inserted at the wrong place. CompositeImageDescriptor#drawImage(ImageData, int, int) must not be called with a null ImageData.

The actual bug was that DecorationOverlayIcon#drawCompositeImage(int, int) called ImageDescriptor#getImageData() and then called drawImage(..) without doing the required null check first.

I'm about to rewrite this code to make ImageDescriptors HiDPI-aware. The fix for bug 495782 will implement this correctly.