Bug 245688 - [misc] MalformedTreeException occuring while formatting may not be surfaced to user in an error dialog
Summary: [misc] MalformedTreeException occuring while formatting may not be surfaced t...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.4   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.4.2   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-29 09:04 EDT by Frederic Fusier CLA
Modified: 2008-10-30 11:53 EDT (History)
4 users (show)

See Also:
markus.kell.r: review+


Attachments
Fix (3.40 KB, patch)
2008-09-01 09:41 EDT, Dani Megert CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Frederic Fusier CLA 2008-08-29 09:04:00 EDT
When MalformedTreeException happens during the formatting, the returned TextEdit is null, hence nothing is changed. Open an error dialog to display this kind of problems sounds a little bit too worrying for the user as there's neither loss of data nor breakage of other functionalities.

An good example of such kind of situation is highlighted by the bug 237592. Because the save action activates the formatter, the user gets an error dialog while saving its file which unnecessarily and wrongly makes him believe that his changes were not saved...

I think that logging the exception instead opening an error dialog would be enough for this kind of problems.
Comment 1 Dani Megert CLA 2008-08-29 10:41:58 EDT
Sounds good. Benno, any objection?

Considering for 3.4.2.
Comment 2 Benno Baumgartner CLA 2008-09-01 03:31:12 EDT
(In reply to comment #1)
> Sounds good. Benno, any objection?

Well, it's better then nothing, but not the nice thing to do. But I would do it only for 3.4.2 and not for 3.5.

> wrongly makes him believe that his changes were not saved...

If the shown error dialog leaves the impression that the file might not be saved then we should improve the dialogs message because the file is always saved, even with a failed save action.
Comment 3 Frederic Fusier CLA 2008-09-01 04:14:46 EDT
(In reply to comment #2)
> (In reply to comment #1)
> > Sounds good. Benno, any objection?
> 
> Well, it's better then nothing, but not the nice thing to do. But I would do it
> only for 3.4.2 and not for 3.5.
> 
That's the goal of this bug. The exception will no longer occur for 3.5 as original bug 234583 has been fixed...

> > wrongly makes him believe that his changes were not saved...
> 
> If the shown error dialog leaves the impression that the file might not be
> saved then we should improve the dialogs message because the file is always
> saved, even with a failed save action.
> 
That's the problem of the opened error dialog just after having pressed on the save button... This kind of dialog is usually used in a panic mode: something bad happened while doing this and the only thing we was able to do was to signal the error to the user... Whatever you can say in this dialog will not make me (as a user) comfortable with the fact that my file was well saved...
Comment 4 Dani Megert CLA 2008-09-01 04:18:25 EDT
> Whatever you can say in this dialog will not
>make me (as a user) comfortable with the fact that my file was well saved...
Are you saying you don't read dialog texts? Come on ;-)
Comment 5 Dani Megert CLA 2008-09-01 09:39:29 EDT
>When MalformedTreeException happens during the formatting, the returned
>TextEdit is null,
There is no returned edit as we get an exception. We would have to add special code for MalformedTreeException during format on save. That's not something I want to do because:
- later you get bug reports with .log entries but the user cannot tell us when/why
  it happened
- the user might be interested that his file (or changed lines) weren't formatted
  correctly


I agree that the error dialog is irritating and in 3.5 its layout is broken.

Fixed in HEAD.
Available in builds > N20080901-2000.
Comment 6 Dani Megert CLA 2008-09-01 09:41:15 EDT
Created attachment 111413 [details]
Fix
Comment 7 Dani Megert CLA 2008-09-25 09:16:25 EDT
Fixed in 3.4.2.
Comment 8 Dani Megert CLA 2008-10-28 08:16:26 EDT
Verified in M20081023-1830 that the dialog looks good.
Comment 9 Dani Megert CLA 2008-10-30 11:53:01 EDT
Verified using I20081029-1823 with older version of JDT Core in order to trigger bug 237592.