Hi All,
I'm able to create a file and read its contents, but when I rename that file between its creation and reading, I get a "java.io.FileNotFoundException".
Here it goes:
1. Creating a new file:
2. Renaming the file:
3. Read file:
I get java.io.FileNotFoundException at line 02 above (BufferedReader br = new BufferedReader(new FileReader(newFile1));)
It seems File reference (newFile1) is still referring to original file that was created (namely, newDir/newFile1.java), whereas the file has been renamed.
As mentioned before, if I remove renaming code, I'm able to read file OK.
Any ideas if this renaming is not allowed in
Java or is a bug?
Many Thanks.