diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-20 09:02:23 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-20 09:02:23 +0000 |
commit | b8520bd2292368b768cccad7a46b6347191d4da0 (patch) | |
tree | 3d1a1dad10c4a43745a5712b185e20b91da0a715 /java/sca/modules/implementation-java-runtime | |
parent | 57d405aff0976a8cfd169068aed2e77f57b2c66c (diff) |
Call destroy if there's an excpeption while calling the init method, to fix JCA_4005
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@827009 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/implementation-java-runtime')
-rw-r--r-- | java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.java b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.java index aeaf60e957..7c96606cf6 100644 --- a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.java +++ b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.java @@ -43,7 +43,16 @@ public class ReflectiveInstanceWrapper<T> implements InstanceWrapper<T> { public void start() throws TargetInitializationException { if (initInvoker != null) { - initInvoker.invokeEvent(instance); + try { + initInvoker.invokeEvent(instance); + } catch (Exception e) { + try { + stop(); + } catch (TargetDestructionException e1) { + throw new TargetInitializationException("TargetDestructionException while handling init exception", e); + } + throw new TargetInitializationException(e); + } } } |