Skip to content

Commit 75b82fb

Browse files
Maksim RubanovMaksim Rubanov
authored andcommitted
Catch the StackOverflowError
Under some rare circumstances scopes may delegate to each other. Normally this is either an error in the DSL implementation or in the implementation of some concrete source(s). This should be handled gracefully though.
1 parent 9744c10 commit 75b82fb

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/scoping/DelegatingScope.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,14 +235,19 @@ public IEObjectDescription getSingleElement(final QualifiedName name) {
235235
if (name == null) {
236236
throw new IllegalArgumentException("Null name in getContentByName"); //$NON-NLS-1$
237237
}
238-
for (final IScope scope : getDelegates()) {
239-
final IEObjectDescription elem = scope.getSingleElement(name);
240-
if (elem != null) {
241-
// ScopeTrace.addTrace(elem, getId());
242-
return elem;
238+
239+
try {
240+
for (final IScope scope : getDelegates()) {
241+
final IEObjectDescription elem = scope.getSingleElement(name);
242+
if (elem != null) {
243+
// ScopeTrace.addTrace(elem, getId());
244+
return elem;
245+
}
243246
}
247+
return getParent().getSingleElement(name);
248+
} catch (StackOverflowError e) {
249+
return STACK_OVERFLOW_EOBJECT_DESCRIPTION;
244250
}
245-
return getParent().getSingleElement(name);
246251
}
247252

248253
@Override

0 commit comments

Comments
 (0)