Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Charles David2017-04-18 13:33:24 +0000
committerPierre-Charles David2017-05-09 07:50:28 +0000
commit6d36166e3938b9aa495584bec0f382f705fba269 (patch)
tree438c1ebd4d14f2cb74e03d9fd6d55a8d3629cc73
parenta73afe69001d953dd0058dbf08c89418e6cd0f44 (diff)
downloadorg.eclipse.sirius-6d36166e3938b9aa495584bec0f382f705fba269.tar.gz
org.eclipse.sirius-6d36166e3938b9aa495584bec0f382f705fba269.tar.xz
org.eclipse.sirius-6d36166e3938b9aa495584bec0f382f705fba269.zip
[495036] Make ServiceInterpreter report the actual cause exception
Bug: 495036 Change-Id: I30cc96d58461fd6f1dcabbe2ac78496ca70aea35 Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.common/src/org/eclipse/sirius/common/tools/internal/interpreter/MonomorphicService.java20
1 files changed, 16 insertions, 4 deletions
diff --git a/plugins/org.eclipse.sirius.common/src/org/eclipse/sirius/common/tools/internal/interpreter/MonomorphicService.java b/plugins/org.eclipse.sirius.common/src/org/eclipse/sirius/common/tools/internal/interpreter/MonomorphicService.java
index 8f1308f542..e10af9c201 100644
--- a/plugins/org.eclipse.sirius.common/src/org/eclipse/sirius/common/tools/internal/interpreter/MonomorphicService.java
+++ b/plugins/org.eclipse.sirius.common/src/org/eclipse/sirius/common/tools/internal/interpreter/MonomorphicService.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 THALES GLOBAL SERVICES.
+ * Copyright (c) 2013, 2017 THALES GLOBAL SERVICES and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -69,14 +69,26 @@ class MonomorphicService implements IMonomorphicService {
Object result = null;
try {
result = serviceMethod.invoke(serviceInstance, target);
- } catch (IllegalArgumentException | IllegalAccessException | InvocationTargetException e) {
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ /*
+ * These exceptions indicate problems in the method invocation
+ * itself, i.e. our service invocation logic is broken and tries to
+ * call inaccesible or incompatible methods.
+ */
fail(e);
+ } catch (InvocationTargetException e) {
+ /*
+ * These exceptions on the other hand represent problems thrown from
+ * inside the service method
+ */
+ Throwable cause = e.getTargetException();
+ fail(cause);
}
return result;
}
- private void fail(Exception e) throws EvaluationException {
- throw new EvaluationException(MessageFormat.format(Messages.MonomorphicService_serviceError, this), e);
+ private void fail(Throwable th) throws EvaluationException {
+ throw new EvaluationException(MessageFormat.format(Messages.MonomorphicService_serviceError, this), th);
}
@Override

Back to the top