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 103067 - Find/Replace in projects removed content of all not saved classes
Summary: Find/Replace in projects removed content of all not saved classes
Status: VERIFIED FIXED
Alias: None
Product: utilities
Classification: Unclassified
Component: Search (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: Marian Petras
URL:
Keywords: JDK_SPECIFIC
Depends on:
Blocks:
 
Reported: 2007-05-01 21:17 UTC by Marian Mirilovic
Modified: 2012-04-25 09:59 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marian Mirilovic 2007-05-01 21:17:22 UTC
NB M9, JDK 1.5.0_11

Steps to reproduce:
- run IDE
- create Java Application project
- write 
     System.out.println("Hello");
  into Main.java and *don't save the file* !
- invoke Edit | Fine/Replace in Projects ...
- type "Hello" and replace with "Hello World"
- push Search button
- push Replace button 
-> the content of Main.java file has been removed and empty file was saved, the
only way to get it back is to use Local History.
Comment 1 Marian Petras 2007-05-02 09:24:20 UTC
I am not able to reproduce at the moment because of other exceptions being
thrown. As soon as I fix these blocking exceptions, I will evaluate this bug and
fix it.
Comment 2 Jana Maleckova 2007-05-02 10:29:01 UTC
seems to be really dependent on java platform. I tested on both 1.6 and 1.5 and
this issue is fully reproducible on 1.5
described steps executed on 1.6 are OK and wanted string is correctly found and
finally replaced without any code lost.
Comment 3 Marian Petras 2007-05-02 10:57:51 UTC
Now that I wanted to reproduce the blocking exceptions during a debugging
session, none of the exceptions occured and I reproduced the bug.
Comment 4 Marian Petras 2007-05-02 13:16:47 UTC
In the branch for milestone 9, I disabled (hid) the replace panel (the "Replace
With:" text-field and the corresponding combo-box) and thus effectively disabled
the replace feature.

Modified files:
   utilities/src/org/netbeans/modules/search/types/:
                                          FullTextCustomizer.java   (1.18.10.1)
                                          FullTextType.java   (1.55.4.1)

Diffs:
http://utilities.netbeans.org/source/browse/utilities/src/org/netbeans/modules/search/types/FullTextCustomizer.java?r1=1.18&r2=1.18.10.1&diff_format=u
http://utilities.netbeans.org/source/browse/utilities/src/org/netbeans/modules/search/types/FullTextType.java?r1=1.55&r2=1.55.4.1&diff_format=u
Comment 5 pcmreddy 2007-05-02 22:36:36 UTC
I tried this in NetBeans IDE 6.0 Preview (M9, build 070502)

As an effect of this fix. Now there is no global replace option at projects level.
Replace option still available at file level. I guess we can live with this for
J1.  Label for this menu/dialog may confuse people.
Comment 6 Marian Petras 2007-05-03 06:17:19 UTC
Caused by bug #103193 ("FileEncodingQuery.ProxyCharset.decode() returns an empty
buffer for input of size 4 kB or less").

Actually, this bug is not reproducible on (ASCII-only) files larger than 4 kB.

Another manifest of the bug is that the preview area in the search results
window is empty for files that would be affected by the bug.
Comment 7 Marian Petras 2007-05-06 11:33:10 UTC
Because fix of bug 103193 is not doable, I will make a workaround suggested by
Tomas Zezula, i.e. use the three-argument variant of the decode(...) method.
Comment 8 Marian Petras 2007-05-06 15:23:50 UTC
Fixed in the trunk.

Modified file:
   utilities/src/org/netbeans/modules/search/MatchingObject.java   (1.6)

Diff:
http://utilities.netbeans.org/source/browse/utilities/src/org/netbeans/modules/search/MatchingObject.java?r1=1.5&r2=1.6&diff_format=u
Comment 9 Jana Maleckova 2007-05-07 11:56:30 UTC
verified on

NetBeans IDE Dev (Build 200705061800)
1.5.0_11; Java HotSpot(TM) Client VM 1.5.0_11-b03
Windows XP version 5.1 running on x86
en_GB (nb); Cp1252
Comment 10 Quality Engineering 2012-04-25 09:59:04 UTC
Integrated into 'main-golden', will be available in build *201204250400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/358f7f0a41c5
User: Jesse Glick <jglick@netbeans.org>
Log: decodeByteBuffer should no longer be needed for #103067/#103193 fixes since JDK 6.