vscode-java icon indicating copy to clipboard operation
vscode-java copied to clipboard

Renaming file causes FileNotFoundException on java language server start

Open panzer-planet opened this issue 8 years ago • 7 comments

##[provide a description of the issue]

Environment
  • Operating System: 10.12.2
  • JDK version: jdk1.8.0_121
  • Visual Studio Code version: 1.9.1
  • Java extension version: 0.0.10
Steps To Reproduce
  1. Rename a file and folder of package In my case it was android/app/src/main/java/za/co/io/reactnativekeystore/KeystoreModule.java android/app/src/main/java/za/co/io/reactnativekeystore/KeystorePackage.java and I renamed them to android/app/src/main/java/za/co/io/reactnativecrypto/CryptoModule.java android/app/src/main/java/za/co/io/reactnativecrypto/CryptoPackage.java
  2. Restart VSCode
  3. Language server fails to start throwing FileNotFoundException

Purging ~/Library/Application Support/Code/User/workspaceStorage and restarting VSCode solved the problem

panzer-planet avatar Feb 14 '17 12:02 panzer-planet

I can't reproduce this issue. Could you please paste a complete stacktrace?

fbricon avatar Feb 14 '17 15:02 fbricon

I have the same issue: I created a folder src and moved all my files inside, but the extension keeps looking for the file at the project root whenever i close/reopen vscode.

File not found: C:\cygwin64\home\Kyasaki\etna2\tic\djav\proj\Main.java.

(Path is now C:\cygwin64\home\Kyasaki\etna2\tic\djav\proj\ src \Main.java.

Kyasaki avatar Mar 13 '17 10:03 Kyasaki

Try the following steps:

  • close VS code
  • delete %APPDATA%\Code\User\workspaceStorage\.
  • restart

fbricon avatar Mar 13 '17 13:03 fbricon

Deleting the workspaceStorage greatly works for me 👍 Doing it manually therefore is a little bit ugly :/

Kyasaki avatar Mar 14 '17 18:03 Kyasaki

The problem still exists—"file not found" errors in console for renamed/removed files—and is still fixable the same way, workspaceStorage: del /s /q %APPDATA%\Code\User\workspaceStorage\ with closed VS code

Operating System: Win 10 Enterprise 14393.1358 JDK version: jdk1.8.0_121 Visual Studio Code version: 1.13.1 Java extension version: 0.6.0

kirilloid avatar Jun 28 '17 14:06 kirilloid

I'm going to say that I still have this same issue, solved by the manual deletion of workspaceStorage. Looks like it just doesn't make a simple check whether the file exists or not, and errors out when it tries to load it.

Operating System: Win 10 Pro 15063.674 JDK version: 1.8.0_144 VScode: 1.17.1 Java extension version: 0.11.0

Dasky14 avatar Oct 13 '17 08:10 Dasky14

Same issue here [REDACTED] when I tried to move/rename a folder/file. As it's impossible for VS Code to support Alias feature of macOS that tracks the path of any file, it must use symbolic link which broke when any folder in the path is renamed, so I removed the folder from the workspace and readied it after renaming. However, what I don't realize is that the Java Language Server still sticks to the path to the file even after it's removed from the workspace! I tried restarting VS Code and even Reinstalling the whole extension pack but neither of them helped — the error persists. Thanks you for your fix 🙂 as I cannot find it anywhere else. It must be a problem that it is saving caches to the disk folder "workspaceStorage" which contains the path to the source files [REDACTED] I think VS Code should add a move/rename folder/file feature

Operating System: macOS High Sierra 10.13.2 JDK version: JDK9 VSCode: 1.19.1 Java extension version: 0.16.0

Error log when I tried to move the folder "Java Test" from ~/No Sync/Java Testing/Java Test to ~/Desktop/Java Test: VS Code Java Extension By Red Hat Error log.txt

Note: I edited this comment and removed unnecessary information and added logs

kevin-he-01 avatar Jan 09 '18 05:01 kevin-he-01