Bug 178980 - [Dialogs] FilteredItemsSelectionDialog should protect against null names
Summary: [Dialogs] FilteredItemsSelectionDialog should protect against null names
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 3.3 M7   Edit
Assignee: Krzysztof Michalski CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-03-23 08:11 EDT by Tod Creasey CLA
Modified: 2007-06-05 14:28 EDT (History)
1 user (show)

See Also:


Attachments
Patch fixes this problem (887 bytes, patch)
2007-03-23 08:42 EDT, Krzysztof Michalski CLA
no flags Details | Diff
Proposition of changes (2.60 KB, patch)
2007-04-05 15:21 EDT, Krzysztof Michalski CLA
no flags Details | Diff
Patch refreshed to head (904 bytes, patch)
2007-04-06 04:08 EDT, Krzysztof Michalski CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tod Creasey CLA 2007-03-23 08:11:24 EDT
FilteredItemsSelectionDialog#getElementName does not allow null values but we have had cases where subclasses have returned null and we should protect against this.

See Bug 178969 for details of the use cases right now.
Comment 1 Krzysztof Michalski CLA 2007-03-23 08:42:02 EDT
Created attachment 61807 [details]
Patch fixes this problem
Comment 2 Krzysztof Michalski CLA 2007-04-05 15:21:30 EDT
Created attachment 63092 [details]
Proposition of changes

Inside patch i used method TableViewer#testFindItem(Object element) to check if element exists inside Table. I see it's hack for test but it's one public method for check it. The other solution is new implementation of TableViewer.

The other fix proposition for this bug is implemenation of ViewerFilter which check if elements exist in TableViewer and do the same as attached patch.
Comment 3 Tod Creasey CLA 2007-04-05 16:30:05 EDT
This patch belongs to Bug 175507
Comment 4 Krzysztof Michalski CLA 2007-04-06 04:08:39 EDT
Created attachment 63153 [details]
Patch refreshed to head

Patch protect against null names.
Comment 5 Tod Creasey CLA 2007-04-24 11:20:02 EDT
Patch released for build >20050424
Comment 6 Markus Keller CLA 2007-04-25 05:18:06 EDT
Is FilteredItemsSelectionDialog#getElementName(Object) now allowed to return null or not?

If it is allowed, then you should update the Javadoc (see also bug 178969 comment 10).

If it is not allowed, then you should not protect call sites in FilteredItemsSelectionDialog (to avoid hiding bugs in client code).
Comment 7 Krzysztof Michalski CLA 2007-04-30 12:10:53 EDT
Yes FilteredItemsSelectionDialog#getElementName(Object) allowed to return null, but in that case we lose camelCase sorting functionality and duplicate checking (all elements are mark as duplicate and will be decorated by container name). Right that should be described. I open new bug for javadoc corrections.