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.
I tried to substitute a string over src/ and javahelp/ in my project. All substitutions were carried out correctly, but for each *.html matches in javahelp/ I was warned (with a separate dialog!) that the IDE could not get a write lock. All files were writable. See stack trace; looks like the search & replace code asks for the encoding of the file *after* opening it for writing, which will not work for file types which sniff the header (in read mode) to determine the encoding. In fact it looks like a (C) character in an unrelated part of the document was replaced with the UTF-8 version despite the ISO-8859-1 encoding declaration, which is consistent with the hypothesis that the IDE fell back to the project encoding (UTF-8). Whether Search & Replace should really be modifying lines in the document which do not match the search expression is another question; arguably a lower-priority bug.
Created attachment 51587 [details] Stack traces
Thanks for the report. I will fix it in the next release (or a module update).
I think this is a P3 bug - besides the annoying warnings, the file contents were corrupted where non-ASCII characters appeared, even far from search hits. There is no permanent data loss (since we now have local history), but trying to revert such bogus changes could still be a real headache if you had a lot of HTML files.
*** Issue 129510 has been marked as a duplicate of this issue. ***
Fixed. I changed the code such that the query about each file's encoding is executed only once (during search) and the same encoding is then used when replacing. Modified files: utilities/src/org/netbeans/modules/search/BasicSearchCriteria.java utilities/src/org/netbeans/modules/search/MatchingObject.java utilities/src/org/netbeans/modules/search/ResultModel.java utilities/src/org/netbeans/modules/search/SearchTask.java utilities/src/org/netbeans/modules/search/SpecialSearchGroup.java Changeset Id: 572797b41915 (http://hg.netbeans.org/main/rev/572797b41915)