Bug 225087 - Undo breaks the code after save when removing of trailing whitespaces on save is enabled
Undo breaks the code after save when removing of trailing whitespaces on save...
Status: VERIFIED FIXED
Product: editor
Classification: Unclassified
Component: -- Other --
7.4
PC Windows 8 x64
: P1 (vote)
: 7.3
Assigned To: Miloslav Metelka
issues@editor
: 73_HR_FIX
: 225052 225133 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-01-19 10:13 UTC by kalwi
Modified: 2013-01-25 10:31 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kalwi 2013-01-19 10:13:15 UTC
If removing of trailing whitespaces from all lines on save is enabled then Undo action may broke the code after that edited file is saved.

How to reproduce:
1) Options -> Editor -> On Save -> Remove Trailing Whitespace From: All Lines.
2) Create a new Java Application project with default Main class template.
3) Do ten or twenty new lines (Enter) between Javadoc comment and main method body (it creates lines with trailing whitespaces).
4) Save the file (Ctrl + S).
5) Press Undo one ore more times (Ctrl + Z), edited code will become broken.

Product Version: NetBeans IDE 7.3 RC1 (Build 201301172100)
Java: 1.7.0_11; Java HotSpot(TM) 64-Bit Server VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_11-b21
System: Windows 8 version 6.2 running on amd64; Cp1250; cs_CZ (nb)

See my exception report (but my comments may be inexact there, I didn't know exact preconditions with clean installation):
http://statistics.netbeans.org/analytics/exception.do?id=649953
Comment 1 Miloslav Metelka 2013-01-21 14:37:07 UTC
Found the problem - it's because of an assert on line UndoRedoManager:397. I'll fix ASAP.
Comment 2 Miloslav Metelka 2013-01-22 09:01:26 UTC
Also fixed a potential problem if there would be multiple undoable edits added to UndoRedoManager during save actions (however right now there's only one edit added so the problem does not show up).
http://hg.netbeans.org/jet-main/rev/2ada0c01559e
Comment 3 Jan Lahoda 2013-01-22 09:16:39 UTC
*** Bug 225133 has been marked as a duplicate of this bug. ***
Comment 4 Jan Lahoda 2013-01-22 09:17:10 UTC
*** Bug 225052 has been marked as a duplicate of this bug. ***
Comment 5 Jiri Prox 2013-01-22 12:58:08 UTC
verified in trunk
Comment 6 Jan Lahoda 2013-01-22 13:03:05 UTC
The fix seems fine to me.
Comment 7 Miloslav Metelka 2013-01-22 16:03:44 UTC
Integrated in release73:
2ada0c01559e transplanted to 1b197cc366fa
Comment 8 Quality Engineering 2013-01-23 00:03:06 UTC
Integrated into 'releases', will be available in build *201301222100* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/1b197cc366fa
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #225087 - Undo breaks the code after save when removing of trailing whitespaces on save is enabled.
(transplanted from 2ada0c01559e93056d0009cabc040eca59fd074a)
Comment 9 Quality Engineering 2013-01-23 02:50:38 UTC
Integrated into 'main-golden', will be available in build *201301230001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/2ada0c01559e
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #225087 - Undo breaks the code after save when removing of trailing whitespaces on save is enabled.
Comment 10 Jiri Prox 2013-01-25 10:31:41 UTC
verified


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo