mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-15 16:28:56 +00:00
[ls/resourceAccess] fail if the resource set is null
Signed-off-by: Anton Kosiakov <anton.kosyakov@typefox.io>
This commit is contained in:
parent
2cfbea4021
commit
2782bd4e8c
3 changed files with 5 additions and 11 deletions
|
@ -25,11 +25,10 @@ class WorkspaceResourceAccess implements IResourceAccess {
|
|||
|
||||
override <R> readOnly(URI targetURI, IUnitOfWork<R, ResourceSet> work) {
|
||||
return workspaceManager.doRead(targetURI) [ document, resource |
|
||||
val resourceSet = resource?.resourceSet
|
||||
if (resourceSet === null) {
|
||||
if (resource === null) {
|
||||
return null
|
||||
}
|
||||
return work.exec(resourceSet)
|
||||
return work.exec(resource.resourceSet)
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
@ -31,15 +31,10 @@ public class WorkspaceResourceAccess implements IReferenceFinder.IResourceAccess
|
|||
public <R extends Object> R readOnly(final URI targetURI, final IUnitOfWork<R, ResourceSet> work) {
|
||||
final Function2<Document, XtextResource, R> _function = (Document document, XtextResource resource) -> {
|
||||
try {
|
||||
ResourceSet _resourceSet = null;
|
||||
if (resource!=null) {
|
||||
_resourceSet=resource.getResourceSet();
|
||||
}
|
||||
final ResourceSet resourceSet = _resourceSet;
|
||||
if ((resourceSet == null)) {
|
||||
if ((resource == null)) {
|
||||
return null;
|
||||
}
|
||||
return work.exec(resourceSet);
|
||||
return work.exec(resource.getResourceSet());
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public interface IReferenceFinder {
|
|||
* Provides safe read access to a resource set for searching local references or references in a demand-created or
|
||||
* shared resource set.
|
||||
*
|
||||
* Return `null` if a resource set cannot be provided for the given target URI.
|
||||
* Return <code>null</code> if a resource set cannot be provided for the given target URI.
|
||||
*/
|
||||
interface IResourceAccess {
|
||||
<R> R readOnly(URI targetURI, IUnitOfWork<R, ResourceSet> work);
|
||||
|
|
Loading…
Reference in a new issue