diff --git a/lemminx-maven/src/main/java/org/eclipse/lemminx/extensions/maven/searcher/LocalRepositorySearcher.java b/lemminx-maven/src/main/java/org/eclipse/lemminx/extensions/maven/searcher/LocalRepositorySearcher.java index 69965b70..34eee462 100644 --- a/lemminx-maven/src/main/java/org/eclipse/lemminx/extensions/maven/searcher/LocalRepositorySearcher.java +++ b/lemminx-maven/src/main/java/org/eclipse/lemminx/extensions/maven/searcher/LocalRepositorySearcher.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019-2020 Red Hat Inc. and others. + * Copyright (c) 2019, 2023 Red Hat Inc. and others. * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 * which is available at https://www.eclipse.org/legal/epl-2.0/ @@ -70,7 +70,7 @@ public Collection getLocalArtifactsLastVersion() throws IOException { new Thread(() -> { WatchKey key; try { - while ((key = watchService.take()) != null) { + while ((key = (watchService != null ? watchService.take() : null)) != null) { if (watchKey.equals(key)) { cache.remove(localRepository); key.reset();