summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-01-07 08:14:43 (EST)
committerEike Stepper2008-01-07 08:14:43 (EST)
commit4efdf306b803c3f53792313f72ced32129a75ca3 (patch)
treeea6c014de81430d71f01ac06c61473d13d1e6c41
parentded7a13caa2c706c1870318e8208fb7e7044d330 (diff)
downloadcdo-4efdf306b803c3f53792313f72ced32129a75ca3.zip
cdo-4efdf306b803c3f53792313f72ced32129a75ca3.tar.gz
cdo-4efdf306b803c3f53792313f72ced32129a75ca3.tar.bz2
[214478] Change the checked exception on ILifecycle.activate() to unchecked
https://bugs.eclipse.org/bugs/show_bug.cgi?id=214478
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/lifecycle/Lifecycle.java24
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/ILifecycle.java2
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java13
3 files changed, 19 insertions, 20 deletions
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/lifecycle/Lifecycle.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/lifecycle/Lifecycle.java
index 44f1bf1..7d6409e 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/lifecycle/Lifecycle.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/lifecycle/Lifecycle.java
@@ -18,6 +18,7 @@ import org.eclipse.net4j.util.ReflectUtil;
import org.eclipse.net4j.util.lifecycle.ILifecycle;
import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
import org.eclipse.net4j.util.lifecycle.ILifecycleState;
+import org.eclipse.net4j.util.lifecycle.LifecycleException;
/**
* @author Eike Stepper
@@ -38,7 +39,7 @@ public class Lifecycle extends Notifier implements ILifecycle.Introspection
{
}
- public final void activate() throws Exception
+ public final void activate() throws LifecycleException
{
if (lifecycleState == ILifecycleState.INACTIVE)
{
@@ -49,8 +50,20 @@ public class Lifecycle extends Notifier implements ILifecycle.Introspection
lifecycleState = ILifecycleState.ACTIVATING;
fireEvent(new LifecycleEvent(this, ILifecycleEvent.Kind.ABOUT_TO_ACTIVATE));
- doBeforeActivate();
- doActivate();
+
+ try
+ {
+ doBeforeActivate();
+ doActivate();
+ }
+ catch (RuntimeException ex)
+ {
+ throw ex;
+ }
+ catch (Exception ex)
+ {
+ throw new LifecycleException(ex);
+ }
if (!isDeferredActivation())
{
@@ -91,10 +104,6 @@ public class Lifecycle extends Notifier implements ILifecycle.Introspection
OM.LOG.error(ex);
return ex;
}
- finally
- {
- lifecycleState = ILifecycleState.INACTIVE;
- }
}
else
{
@@ -187,6 +196,7 @@ public class Lifecycle extends Notifier implements ILifecycle.Introspection
protected final void deferredDeactivate() throws Exception
{
doDeactivate();
+ lifecycleState = ILifecycleState.INACTIVE;
fireEvent(new LifecycleEvent(this, ILifecycleEvent.Kind.DEACTIVATED));
}
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/ILifecycle.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/ILifecycle.java
index a3c561d..fd44921 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/ILifecycle.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/ILifecycle.java
@@ -15,7 +15,7 @@ package org.eclipse.net4j.util.lifecycle;
*/
public interface ILifecycle
{
- public void activate() throws Exception;
+ public void activate() throws LifecycleException;
public Exception deactivate();
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java
index d51804e..e27de48 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java
@@ -68,18 +68,7 @@ public final class LifecycleUtil
{
if (object instanceof ILifecycle)
{
- try
- {
- ((ILifecycle)object).activate();
- }
- catch (RuntimeException ex)
- {
- throw ex;
- }
- catch (Exception ex)
- {
- throw new LifecycleException(ex);
- }
+ ((ILifecycle)object).activate();
}
else if (object != null && useAnnotation)
{