[eclipse/xtext#1651] made error handling in StorageAwareResource null-safe

Signed-off-by: Christian Dietrich <christian.dietrich@itemis.de>
This commit is contained in:
Christian Dietrich 2020-01-20 12:50:55 +01:00
parent 9d419220eb
commit 6b552f0659
2 changed files with 8 additions and 4 deletions

View file

@ -44,8 +44,8 @@ class StorageAwareResource extends LazyLinkingResource {
return;
} catch(IOException e) {
// revert the resource into a clean state
contents.clear
eAdapters.clear
contents?.clear
eAdapters?.clear
unload
}
}

View file

@ -68,8 +68,12 @@ public class StorageAwareResource extends LazyLinkingResource {
return;
} catch (final Throwable _t) {
if (_t instanceof IOException) {
this.contents.clear();
this.eAdapters.clear();
if (this.contents!=null) {
this.contents.clear();
}
if (this.eAdapters!=null) {
this.eAdapters.clear();
}
this.unload();
} else {
throw Exceptions.sneakyThrow(_t);