Skip to content

Commit

Permalink
Fix NPE in 'LocalRepositorySearcher.getLocalArtifactsLastVersion'
Browse files Browse the repository at this point in the history
```
Exception in thread "Thread-61" java.lang.NullPointerException: Cannot invoke "java.nio.file.WatchService.take()" because "this.watchService" is null
	at org.eclipse.lemminx.extensions.maven.searcher.LocalRepositorySearcher.lambda$getLocalArtifactsLastVersion$1(LocalRepositorySearcher.java:73)
	at java.base/java.lang.Thread.run(Thread.java:833)
```
  • Loading branch information
vrubezhny committed Jul 7, 2023
1 parent ad1d478 commit 7405e55
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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/
Expand Down Expand Up @@ -70,7 +70,7 @@ public Collection<Artifact> 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();
Expand Down

0 comments on commit 7405e55

Please sign in to comment.