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 95203

Summary: "File has changed since the start of the search"
Product: utilities Reporter: Max Sauer <msauer>
Component: SearchAssignee: Jiri Rechtacek <jrechtacek>
Status: REOPENED ---    
Severity: blocker CC: anebuzelsky, kawazu428, mmikeyy, vriha, ynov
Priority: P2    
Version: 6.x   
Hardware: PC   
OS: Windows 7 x64   
Issue Type: DEFECT Exception Reporter:
Attachments: the file have no changes! svn highlight show the truth.

Description Max Sauer 2007-02-12 09:57:48 UTC
S&R won't replace multiple occurences of searched text on same LOC.

Steps to reproduce:
-------------------
1) Consider following properties file:

TXT_DisplayName=My Server
MSG_InstallerName=My Server Installer
MSG_CreateFailed=Cannot create {0} server instance.
MSG_MyServerPlatform=My Server Platform

2) Now invoke S&R over whole project and try to replace 'My' with something
else, ie. 'Ge'.
=> Nothing will be replaced, inside Search Results tab, a message appears
complaining that the file has been changed since the search starts (it has been
indeed, but S&R should handle such situations).

---
NetBeans IDE Dev (Build 070212)
1.6.0; Java HotSpot(TM) Server VM 1.6.0-b105
Linux version 2.6.12-1.1390_FC4smp running on i386
en_US (nb); UTF-8
Comment 1 Marian Petras 2007-02-14 09:58:54 UTC
I cannot reproduce it on my machine. What do you exactly mean by "multiple
entries on some LOC"?
Comment 2 Max Sauer 2007-02-14 11:01:45 UTC
Still reproducible. Please check the Geronimo project from roman-ws, as we have
agreed. Also note my dual CPU (SMP) mashine.
Comment 3 Marian Petras 2007-03-23 17:13:07 UTC
Accepted.
Comment 4 Marian Petras 2008-01-11 10:42:32 UTC
*** Issue 102340 has been marked as a duplicate of this issue. ***
Comment 5 kawazu428 2008-06-18 10:40:25 UTC
Adding myself to the list, seeing the same issue trying to replace version numbers in pom.xml across a set of maven2
projects. 

Product Version: NetBeans IDE Dev (Build 200806180005)
Java: 1.6.0_10-beta; Java HotSpot(TM) Client VM 11.0-b11
System: Linux version 2.6.24-19-generic running on i386; UTF-8; de_DE (nb)
Userdir: /home/kr/.netbeans/dev-6.1
Comment 6 Marian Petras 2008-07-28 20:30:38 UTC
I was able to reproduce this if the file being changed contained CR+LF line endings. I am going to fix this case at first.
Comment 7 Marian Petras 2008-07-30 12:38:51 UTC
Fixed.

The files being searched are now read using a custom reader that not only recognizes all common types of line endings
(CR, LF, CR+LF). This was enough to fix the cause of the bug. The reader also keeps information about used line ending
per each line and uses the same line endings when writing the modified file to the disk.

Modified and new files:
    utilities/src/org/netbeans/modules/search/LineReader.java
    utilities/src/org/netbeans/modules/search/MatchingObject.java
    utilities/test/unit/src/org/netbeans/modules/search/LineReaderTest.java
    utilities/test/unit/src/org/netbeans/modules/search/MatchingObjectTest.java

Changeset Id:
0c54dd6caf5f
(http://hg.netbeans.org/main/rev/0c54dd6caf5f)
Comment 8 Marian Petras 2008-07-30 12:40:08 UTC
kawazu428, it would be perfect if you could verify the fix.
Comment 9 Quality Engineering 2008-07-30 15:46:29 UTC
Integrated into 'main-golden', available in build *200807301401* on http://bits.netbeans.org/dev/nightly/
Changeset: http://hg.netbeans.org/main/rev/0c54dd6caf5f
User: Marian Petras <mpetras@netbeans.org>
Log: fixed bug #95203 - "File has changed since the start of the search"
Comment 10 kawazu428 2008-07-31 07:17:45 UTC
verified against current nightly build - thanks very much! :)

Product Version: NetBeans IDE Dev (Build 200807310201)
Java: 1.6.0_10-rc; Java HotSpot(TM) Client VM 11.0-b15
System: Linux version 2.6.24-20-generic running on i386; UTF-8; de_DE (nb)
Userdir: /home/kr/.netbeans/dev-6.5
Comment 11 williamuk 2010-03-26 07:44:27 UTC
Encountered the same problem on Windows XP. Step to reproduce:
- Create a project
- Add several 'htm' files into the project, under src
- Use Ctrl+H to Find & Replace the same word on the project
- Make sure that a found list is produced.
- Press 'Replace'. 

There are some files which has been replaced, but some don't, with the same error messages. Perform 'Modify Criteria' then do a Find again, and you'll find untouched intstances. Tested on 

Product Version: NetBeans IDE 6.8 (Build 200912041610)
Java: 1.6.0_02; Java HotSpot(TM) Client VM 1.6.0_02-b06
System: Windows XP version 5.1 running on x86; Cp1252; en_GB (nb)
Comment 12 williamuk 2010-03-26 07:59:55 UTC
A further note on the bug: It seems to appear when there are multiple instances of found text on the file.
Comment 13 williamuk 2010-03-26 10:13:16 UTC
The notice regarding to the multiple instances in the file is invalid. The problem is also located on Linux and with files contain only single instance of found text.

Product Version: NetBeans IDE 6.8 (Build 200912041610)
Java: 1.6.0_15; Java HotSpot(TM) Client VM 14.1-b02
System: Linux version 2.6.27.42-0.1-pae running on i386; UTF-8; en_US (nb)
Comment 14 williamuk 2010-03-26 12:01:45 UTC
In a desparate attempt, reused previous version 6.7.1 and the problem doesn't exist there. Tested on both Linux and Windows XP, and they are working fine.

Product Version: NetBeans IDE 6.7.1 (Build 200907230233)
Java: 1.6.0_02; Java HotSpot(TM) Client VM 1.6.0_02-b06
System: Windows XP version 5.1 running on x86; Cp1252; en_GB (nb)
Comment 15 williamuk 2010-03-26 12:04:25 UTC
Reused previous version 6.7.1 and the problem doesn't exist there. Tested on both Linux and Windows XP, and they are working fine. Some changes since then reintroduced the problem.

Product Version: NetBeans IDE 6.7.1 (Build 200907230233)
Java: 1.6.0_02; Java HotSpot(TM) Client VM 1.6.0_02-b06
System: Windows XP version 5.1 running on x86; Cp1252; en_GB (nb)
Comment 16 williamuk 2010-03-26 12:05:16 UTC
Reused previous version 6.7.1 and the problem doesn't exist there. Tested on both Linux and Windows XP, and they are working fine. Some changes since then reintroduced the problem.

Product Version: NetBeans IDE 6.7.1 (Build 200907230233)
Java: 1.6.0_02; Java HotSpot(TM) Client VM 1.6.0_02-b06
System: Windows XP version 5.1 running on x86; Cp1252; en_GB (nb)
Comment 17 williamuk 2010-03-26 12:05:49 UTC
Reused previous version 6.7.1 and the problem doesn't exist there. Tested on both Linux and Windows XP, and they are working fine. Some changes since then reintroduced the problem.

Product Version: NetBeans IDE 6.7.1 (Build 200907230233)
Java: 1.6.0_02; Java HotSpot(TM) Client VM 1.6.0_02-b06
System: Windows XP version 5.1 running on x86; Cp1252; en_GB (nb)
Comment 18 williamuk 2010-03-28 10:22:09 UTC
Further observation shown that in fact, the 6.7.1 did not solve the problem. It just keeps quiet and did not report anything. Closer look at the result shown that some files had been ignored. The problem seems to be reduced when the number of input files into the global search and replace, but the problem still recur. Posted a duplicated log and was told that the problem has been fixed by 6.8. Turned ton use 6.8 and found another problem.

After the message "File <filename> has changed since the start of the search" came up, I went into the claimed file, performed find and replaced on the file alone, but on subsequent set of files, the same message kept coming up, although the file mentioned is NOT within the group of selected files.

Tested on:

Product Version: NetBeans IDE 6.8 (Build 200912041610)
Java: 1.6.0_02; Java HotSpot(TM) Client VM 1.6.0_02-b06
System: Windows XP version 5.1 running on x86; Cp1252; en_GB (nb)
Comment 19 Victor Vasilyev 2010-05-14 00:57:58 UTC
williamuk,

Many thanks for detailed bug report and your investigations, but I can't reproduce this with 6.9 dev build.

My steps to reproduce:
* Create a Java project
* Add three new 'html' files into the project, under the
  "Source Packages/javaapplication1":
  newhtml.html, newhtml1.html, newhtml2.html
  with content provided by the default template.
* Select "Source Packages/javaapplication1"
* Ctrl+Shift+H to Find & Replace with 
  - Containing Text "To"
  - Replace With "TO"
=> a found list is produced
* Press 'Replace'. 
=> All occurrences of "To" are successfully replaced with "TO" without any messages.
Comment 20 pbelbin 2011-04-28 02:14:14 UTC
using Netbeans 7.0, I am seeing this issue again.

I'm using Windows 7, and the files appear to have come from a unix system.

if I do a project level find and replace, it balks at doing the changes, claiming that the file has changed since the start of the search.
Comment 21 coops 2011-05-04 13:00:20 UTC
I get this issue too. Netbeans 7 is unable to find and replace. I'm going back to 6.9.1 since this feature is critical for me when I'm refactoring.
Comment 22 wvankuipers 2011-05-10 08:41:43 UTC
Confirmed!

Specs:
Netbeans 7
OS Windows 7 X64 Professional
Comment 23 wvankuipers 2011-05-10 08:50:42 UTC
(In reply to comment #19)
> williamuk,
> 
> Many thanks for detailed bug report and your investigations, but I can't
> reproduce this with 6.9 dev build.
> 
> My steps to reproduce:
> * Create a Java project
> * Add three new 'html' files into the project, under the
>   "Source Packages/javaapplication1":
>   newhtml.html, newhtml1.html, newhtml2.html
>   with content provided by the default template.
> * Select "Source Packages/javaapplication1"
> * Ctrl+Shift+H to Find & Replace with 
>   - Containing Text "To"
>   - Replace With "TO"
> => a found list is produced
> * Press 'Replace'. 
> => All occurrences of "To" are successfully replaced with "TO" without any
> messages.

This is because you only do one replace. The error ocures when you try to perform a second replace on the same set of documents.

So next try to replace "TO" with "2" and you will get the message that the serach results have changed and you need to refresh them (endless loop)
Comment 24 apric 2011-05-11 14:52:55 UTC
reproducible:
- Windows Vista Business 32bit
- Netbeans 7.0 (with Java 1.6.24), fresh install with factory settings
- Antivir disabled (does not matter)

project:
- fresh SVN checkout, fresh "PHP project with existing sources" created afterwards
- PHP+HTML files only (in our case: Selenium test case files)

steps:
- select the folder containing the HTML files in the project view
- ctrl+shift+h
- enter the search and replace terms
- press "find"
-> search results view opens up correctly
- click the "replace" button
-> messages appear saying that "The following issues were encountered while replacing:" and mutilple times: "File xyz has changed since the start of the search"; no replacements were being made

With third-party tools like JEdit or Notepad++ the search+replace for the whole folder works fine, and Netbeans correctly marks them blue afterwards (meaning: files changed since last SVN update).

Seems this bug is Windows-only, since it works fine on MacOS and Ubuntu.
Comment 25 Jiri Rechtacek 2011-05-12 09:06:00 UTC
Not reproducible on Ubuntu, will try on Windows 7.
Comment 26 Jiri Rechtacek 2011-05-25 06:45:58 UTC
Still finding a reproducible use-case, works for me on Windows Vista. Haven't I missed anything important? I have svn server on my machine, php project there. S&R twice. By chance, could someone attach a link to test project on which I can reproduce it? Thanks
Comment 27 zoszsoz 2011-06-02 05:55:27 UTC
2 June 2011 here, search and replace is still broken in 7.0. When I click the replace button it just says "File Y:/site/library/page.php has changed since the start of the search. Very strange seeing I didn't even have the file open. Re-did the search and replace with no files open. Still comes up with the error. Tried it in version 6.9.1 and it works perfectly.

Can this be increased to critical priority? I'm going to have to go back to 6.9.1 until this is fixed.

I'm using XP 32bit if that makes any difference.
Comment 28 alexladerman 2011-06-03 18:39:54 UTC
I have the same problem whilst trying a replace in files, with a regex. But in my case the replace does not work in 6.9.1 either, except that it does not display the error message. The replace has no effect in either version.
Comment 29 greenone 2011-06-08 09:52:08 UTC
I can confirm the Bug on:

Product Version: NetBeans IDE 7.0 (Build 201104080000)
Java: 1.6.0_24; Java HotSpot(TM) 64-Bit Server VM 19.1-b02-334
System: Mac OS X version 10.6.7 running on x86_64; MacRoman; de_DE (nb)

Please fix this asap! I heavily rely on search+replace
Comment 30 Jiri Rechtacek 2011-06-13 20:20:53 UTC
Well, I can reproduce it too with NB7.0 FCS on Windows Vista. Now I can start investigating possible fix of this problem. I'll let you know the status soon.

Product Version         = NetBeans IDE 7.0 (Build 201104080000) (#a693229ccdbb)
Operating System        = Windows Vista version 6.0 running on x86
Java; VM; Vendor        = 1.6.0_21; Java HotSpot(TM) Client VM 17.0-b17; Sun Microsystems Inc.
Runtime                 = Java(TM) SE Runtime Environment 1.6.0_21-b07
Comment 31 Jiri Rechtacek 2011-06-15 08:33:59 UTC
core-main/rev/ae8ecacc3d9e
Comment 32 Jiri Rechtacek 2011-06-15 09:03:11 UTC
The fix was backported to NB701 (this regression was caused by changeset http://hg.netbeans.org/main/rev/3a331f02b4f1, Fix #194326 -  NullPointerException at org.netbeans.modules.search.MatchingObject.getName)
Comment 33 Quality Engineering 2011-06-16 19:56:44 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/ae8ecacc3d9e
User: Jiri Rechtacek <jrechtacek@netbeans.org>
Log: #95203: File has changed since the start of the search
Comment 34 aleciri 2011-07-22 09:35:59 UTC
Created attachment 109567 [details]
the file have no changes!  svn highlight show the truth.

Product Version: NetBeans IDE 7.0 (Build 201104080000)
Java: 1.6.0_24; Java HotSpot(TM) 64-Bit Server VM 19.1-b02-334
System: Mac OS X version 10.6.7 running on x86_64; MacRoman; it_IT (nb)
Userdir: /Users/aleciri/.netbeans/7.0


I still have this bug, look at the screenshot: the file "aggiungiLabel.php" have no changes, svn color highlight can confirm it, is black!
Comment 35 Jaroslav Havlin 2011-08-10 07:19:57 UTC
*** Bug 198743 has been marked as a duplicate of this bug. ***
Comment 36 darkerror 2016-09-07 14:34:27 UTC
is this issues fixed? can't find the solution.
Comment 37 darkerror 2016-09-07 14:34:59 UTC
is this issue fixed? can't find the solution.