Skip to content

Commit

Permalink
remove obsolete null check
Browse files Browse the repository at this point in the history
  • Loading branch information
ghentschke committed Feb 14, 2025
1 parent b4eb10c commit 582aabe
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions org.eclipse.lsp4e/src/org/eclipse/lsp4e/ResourceForUriCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,23 @@ public IResource get(@Nullable URI uri) {
// Note: The load method in CacheLoader/LoadingCache cannot be applied here because
// the load method has to return a non-null value.
// But it cannot be guaranteed that there can be a IResource fetched for the given URI.
URI localURI = uri;
IResource resource = null;
if (uri != null) {
resource = cache.getIfPresent(uri);
if (localURI != null) {
resource = cache.getIfPresent(localURI);
if (resource != null) {
return resource;
}
resource = findResourceFor(uri);
resource = findResourceFor(localURI);
if (resource != null) {
cache.put(uri, resource);
cache.put(localURI, resource);
}
}
return resource;
}

@Nullable
private static IResource findResourceFor(@Nullable URI uri) {
if (uri == null) {
return null;
}
private static IResource findResourceFor(URI uri) {
if (FILE_SCHEME.equals(uri.getScheme())) {
IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();

Expand Down

0 comments on commit 582aabe

Please sign in to comment.