From 0e73a305b4ff1c1049746a398132943c7d58155a Mon Sep 17 00:00:00 2001 From: rubenporras <43636626+rubenporras@users.noreply.github.com> Date: Mon, 9 Oct 2023 09:07:19 +0200 Subject: [PATCH] Prevent failure of DocumentContentSynchronizer. (#841) Prevent failure of DocumentContentSynchronizer. if the document does not have an URI registered in EFS and it is not a file uri. Also improve the existing log to include the URI that we are failing to deal with. --- .../src/org/eclipse/lsp4e/DocumentContentSynchronizer.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/DocumentContentSynchronizer.java b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/DocumentContentSynchronizer.java index 63648e60f..86cc8375f 100644 --- a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/DocumentContentSynchronizer.java +++ b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/DocumentContentSynchronizer.java @@ -97,8 +97,11 @@ public DocumentContentSynchronizer(@NonNull LanguageServerWrapper languageServer IFileStore store = EFS.getStore(fileUri); this.openSaveStamp = store.fetchInfo().getLastModified(); } catch (CoreException e) { - LanguageServerPlugin.logError(e); - this.openSaveStamp = new File(fileUri).lastModified(); + try { + this.openSaveStamp = new File(fileUri).lastModified(); + } catch (IllegalArgumentException iae) { + this.openSaveStamp = 0L; + } } this.syncKind = syncKind != null ? syncKind : TextDocumentSyncKind.Full;