This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 381418 - AbstractElementListSelectionDialog.handleElementsChanged assumes fMessage is non-null
Summary: AbstractElementListSelectionDialog.handleElementsChanged assumes fMessage is ...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 4.3.1   Edit
Assignee: Eric Moffatt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-01 14:33 EDT by Tor Norbye CLA
Modified: 2014-03-26 12:07 EDT (History)
2 users (show)

See Also:


Attachments
Add a null (and disposed check) (962 bytes, patch)
2012-06-20 15:42 EDT, Eric Moffatt CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tor Norbye CLA 2012-06-01 14:33:53 EDT
Build Identifier: I20120518-2145

Our plugin crashes on Eclipse 4.2 (and probably 3.8) when we call setListElements(), with this exception:

java.lang.NullPointerException
	at org.eclipse.ui.dialogs.AbstractElementListSelectionDialog.handleElementsChanged(AbstractElementListSelectionDialog.java:190)
	at org.eclipse.ui.dialogs.AbstractElementListSelectionDialog.setListElements(AbstractElementListSelectionDialog.java:179)
	at 

This is because setListElements() calls handleElementsChanged() which looks like this:

	protected void handleElementsChanged() {
		boolean enabled = !fFilteredList.isEmpty();
		fMessage.setEnabled(enabled);     <============

We hit an NPE here because fMessage is null in our case. We don't call createMessageArea() when creating our dialog; we put various other controls (radio buttons if I recall correctly) in the message area instead.

I can work around this (by calling the method and then making the label invisible), but this is likely a compatibility bug which might affect others as well, so it's probably better if you add a null check on the above field access.



Reproducible: Always

Steps to Reproduce:
This bug was originally filed against the Android Eclipse plugin, and the exact steps to reproduce are listed there: http://code.google.com/p/android/issues/detail?id=32527
Comment 1 Eric Moffatt CLA 2012-06-20 15:42:08 EDT
Created attachment 217650 [details]
Add a null (and disposed check)
Comment 2 Eric Moffatt CLA 2012-06-20 15:43:34 EDT
Sorry, didn't check the patch close enough...;~).

This fix will be in the maintenance release.
Comment 3 Wayne Beaton CLA 2013-05-13 23:19:58 EDT
(In reply to comment #2)
> Sorry, didn't check the patch close enough...;~).
> 
> This fix will be in the maintenance release.

Should this bug be marked FIXED?
Comment 4 Paul Webster CLA 2014-03-26 12:07:23 EDT
Yes, it's been released.