Bug 211664 - [ErrorHandling] ErrorDialog should not display 'Details' button when the children status don't have message
Summary: [ErrorHandling] ErrorDialog should not display 'Details' button when the chil...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P5 normal (vote)
Target Milestone: 3.6 M3   Edit
Assignee: Krzysztof Daniel CLA
QA Contact: Kevin McGuire CLA
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2007-11-30 20:33 EST by Janice Li CLA
Modified: 2009-12-10 07:13 EST (History)
2 users (show)

See Also:


Attachments
Fix (783 bytes, patch)
2009-09-01 04:50 EDT, Krzysztof Daniel CLA
no flags Details | Diff
Fix v2 (3.06 KB, patch)
2009-09-03 08:34 EDT, Krzysztof Daniel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Janice Li CLA 2007-11-30 20:33:51 EST
Build ID: I20070625-1500

Steps To Reproduce:
Currently, ErrorDialog will display the 'Details' button when the status is a MultiStatus or the status has exception. But if it is MultiStatus and all its children status don't have any message, 'Details' button will open a list with nothing in it. It would be nice if ErrorDialog can check if the children status have any message. If not, don't display the 'Details' button.

More information:
Comment 1 Krzysztof Daniel CLA 2008-02-19 05:46:59 EST
I think that if you have MultiStatus then details should show child statuses messages or exceptions.
But if you encounter situation in which MultiStatus has children without any information, then I believe that it is invalid MultiStatus usage and separate bug report should be created.
Comment 2 Janice Li CLA 2008-02-19 13:09:06 EST
(In reply to comment #1)
I would suggest ErrorDialog not rely on passed parameters to behave gracefully.
Comment 3 Susan McCourt CLA 2009-07-09 19:05:04 EDT
As per http://wiki.eclipse.org/Platform_UI/Bug_Triage_Change_2009
Comment 4 Kevin McGuire CLA 2009-07-10 11:02:12 EDT
Hmmm, hiding them may actually be hiding a bug, making it harder for a developer to track down the real error in the status creation ("hey, why are there no details?").

It's one of those things that you'd want to work differently in a product than during development. But we can't tell the difference. Generally in Eclipse we don't hide programming errors unless the result is catastrophic.  Is this a frequent occurrence?
Comment 5 Janice Li CLA 2009-08-31 19:30:39 EDT
Pretty often, the top level code creates MultiStatus and passes it to several other processes to try to collect children error status (for example). If no children error status is collected, MultiStatus would only contain the top level error. In this case, to make the 'Details' button not visible, before calling ErrorDialog, our code has to convert MultiStatus to IStatus and then call ErrorDialog, because 'Details' button would be visible without checking if MultiStatus has children or not.
Comment 6 Krzysztof Daniel CLA 2009-09-01 04:36:54 EDT
Janice,
do you use JFace error dialog or StatusManager?
Comment 7 Krzysztof Daniel CLA 2009-09-01 04:50:51 EDT
Created attachment 146167 [details]
Fix
Comment 8 Krzysztof Daniel CLA 2009-09-01 04:57:11 EDT
Kevin, Janice,

could you look at this fix?

I'll release it this week if no objections is reported.
Comment 9 Janice Li CLA 2009-09-01 13:04:50 EDT
I don't think the fix would work if MultiStatus has children status, but children status don't match displayMask. The logic in 'populateList()' and 'shouldShowDetailsButton()' has to be consistent.
Comment 10 Krzysztof Daniel CLA 2009-09-03 08:34:58 EDT
Created attachment 146379 [details]
Fix v2

I have duplicated populateList logic to be sure that the button is displayed if and only if something will be placed on the list.

But unfortunately MultiStatus, if created without children, is always OK, so details will be not displayed, even if later error child statuses are added.  

This is quite suprising.
Comment 11 Kevin McGuire CLA 2009-09-09 20:58:58 EDT
(In reply to comment #10)
> Created an attachment (id=146379) [details]
> Fix v2
> 
> I have duplicated populateList logic to be sure that the button is displayed if
> and only if something will be placed on the list.

Looks fine.

I did find this a bit curious though, I guess it yields what users would expect:

+			// Only print the exception message if it is not contained in the
+			// parent message
+			if (message == null || message.indexOf(eStatus.getMessage()) == -1) {
+				result |= listContentExists(eStatus, true);
+			}
Comment 12 Krzysztof Daniel CLA 2009-10-01 09:02:44 EDT
Patch slightly modified (more javadocs) and released on 2009-10-01
Comment 13 Krzysztof Daniel CLA 2009-12-10 07:13:32 EST
verified.