This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 101694 - The diff window source text scrambled in refactoring preview
Summary: The diff window source text scrambled in refactoring preview
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 6.x
Hardware: All Windows XP
: P2 blocker (vote)
Assignee: Pavel Flaska
URL:
Keywords: RELNOTE
Depends on:
Blocks:
 
Reported: 2007-04-19 08:17 UTC by _ sandipchitale
Modified: 2007-05-04 08:56 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Move refactoring preview diff view showing scrambled package statement. (133.65 KB, image/jpeg)
2007-04-19 08:19 UTC, _ sandipchitale
Details
x (2.38 KB, application/octet-stream)
2007-05-02 14:57 UTC, Pavel Flaska
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ sandipchitale 2007-04-19 08:17:47 UTC
1. Create J2SE project.
2. Create package newpackage.
3. Create classes NewClass and NewClass1 in newpackage.
4. Add instances variables of others type in each of the above classes.
5. Create package newpackage1.
6. Invoke MOve Class reafctoring on NewClass1 to move it to newpackage1.
7. Look in the preview window diff views. The package statement looks 
scrambled (see attachment).
8. The refactoring seems to work though.
Comment 1 _ sandipchitale 2007-04-19 08:19:50 UTC
Created attachment 41220 [details]
Move refactoring preview diff view showing scrambled package statement.
Comment 2 Jan Becicka 2007-04-26 09:24:38 UTC
I use ModificationResult.getResultingSource() which returns scrambled source in
this case.
Comment 3 Pavel Flaska 2007-04-26 10:09:36 UTC
I heard about it. Seems to be again platform specific.
Comment 4 Pavel Flaska 2007-04-26 13:45:23 UTC
Caused by hacky stuff when fixing #102292. Just preview is broken, resulting
source should be ok.

Comment 5 _ sandipchitale 2007-04-26 14:29:28 UTC
If the preview appears to corrupt user's source code, they may not even 
attempt to go ahead with refactoring to find out it will work.
Comment 6 Pavel Flaska 2007-04-26 14:43:16 UTC
Yes. It will switch the user to panic mode, I think. I'm rather refactor without
preview :-). (Just joking, I'm still working on it.) Generator is ok, if you put
breakpoint in CasualDiff:90, there is a resulting source which is correct I
think.  Because of the history if development, there are two phases in commit,
which I want to rewrite to just one. This should have positive performance
impact. But for the time being, I'm looking for another terrible hacks.
Comment 7 Pavel Flaska 2007-04-26 21:34:54 UTC
It is caused by the same thing as it was in #88424. When diffing to temporary
file, stream is read from disk where both cr/lf are in the source.
Comment 8 Pavel Flaska 2007-05-02 14:57:40 UTC
Created attachment 42049 [details]
x
Comment 9 Pavel Flaska 2007-05-04 08:36:32 UTC
Hopefully fixed, please, verify. Needs some other improvements, it will be part
of performance tuning.

Checking in src/org/netbeans/api/java/source/ModificationResult.java;
/cvs/java/source/src/org/netbeans/api/java/source/ModificationResult.java,v  <--
 ModificationResult.java
new revision: 1.11; previous revision: 1.10
done