Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2020-06-30 04:55:41 +0000
committerEike Stepper2020-06-30 04:55:41 +0000
commitb7168050123f98e1cff83f4a5cb4f81902122581 (patch)
tree2c77412832747b5ba760e9ad6f4b95788a2eda78
parent0982e582384c56c10f291ab96649f12290f9db31 (diff)
downloadcdo-b7168050123f98e1cff83f4a5cb4f81902122581.tar.gz
cdo-b7168050123f98e1cff83f4a5cb4f81902122581.tar.xz
cdo-b7168050123f98e1cff83f4a5cb4f81902122581.zip
[564754] Provide a RunnableWithException interface
https://bugs.eclipse.org/bugs/show_bug.cgi?id=564754
-rw-r--r--features/org.eclipse.net4j-feature/feature.xml2
-rw-r--r--features/org.eclipse.net4j-feature/pom.xml2
-rw-r--r--features/org.eclipse.net4j.db-feature/feature.xml2
-rw-r--r--features/org.eclipse.net4j.db-feature/pom.xml2
-rw-r--r--features/org.eclipse.net4j.sdk-feature/feature.xml2
-rw-r--r--features/org.eclipse.net4j.sdk-feature/pom.xml2
-rw-r--r--features/org.eclipse.net4j.util-feature/feature.xml2
-rw-r--r--features/org.eclipse.net4j.util-feature/pom.xml2
-rw-r--r--features/org.eclipse.net4j.util.ui-feature/feature.xml2
-rw-r--r--features/org.eclipse.net4j.util.ui-feature/pom.xml2
-rw-r--r--plugins/org.eclipse.net4j.util/META-INF/MANIFEST.MF62
-rw-r--r--plugins/org.eclipse.net4j.util/pom.xml2
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/RunnableWithException.java51
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerPersistence.java2
14 files changed, 93 insertions, 44 deletions
diff --git a/features/org.eclipse.net4j-feature/feature.xml b/features/org.eclipse.net4j-feature/feature.xml
index 5283b02873..1c31c4ece8 100644
--- a/features/org.eclipse.net4j-feature/feature.xml
+++ b/features/org.eclipse.net4j-feature/feature.xml
@@ -12,7 +12,7 @@
<feature
id="org.eclipse.net4j"
label="%featureName"
- version="4.10.0.qualifier"
+ version="4.11.0.qualifier"
provider-name="%providerName"
image="eclipse_update_120.jpg"
license-feature="org.eclipse.emf.cdo.license"
diff --git a/features/org.eclipse.net4j-feature/pom.xml b/features/org.eclipse.net4j-feature/pom.xml
index 8601da69cf..6ccc7632f4 100644
--- a/features/org.eclipse.net4j-feature/pom.xml
+++ b/features/org.eclipse.net4j-feature/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.eclipse.emf.cdo.features</groupId>
<artifactId>org.eclipse.net4j</artifactId>
- <version>4.10.0-SNAPSHOT</version>
+ <version>4.11.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>
diff --git a/features/org.eclipse.net4j.db-feature/feature.xml b/features/org.eclipse.net4j.db-feature/feature.xml
index 1dae8377b6..c94a5eca90 100644
--- a/features/org.eclipse.net4j.db-feature/feature.xml
+++ b/features/org.eclipse.net4j.db-feature/feature.xml
@@ -12,7 +12,7 @@
<feature
id="org.eclipse.net4j.db"
label="%featureName"
- version="4.10.0.qualifier"
+ version="4.11.0.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.emf.cdo.license"
license-feature-version="0.0.0">
diff --git a/features/org.eclipse.net4j.db-feature/pom.xml b/features/org.eclipse.net4j.db-feature/pom.xml
index 93015026ae..6f21a828ed 100644
--- a/features/org.eclipse.net4j.db-feature/pom.xml
+++ b/features/org.eclipse.net4j.db-feature/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.eclipse.emf.cdo.features</groupId>
<artifactId>org.eclipse.net4j.db</artifactId>
- <version>4.10.0-SNAPSHOT</version>
+ <version>4.11.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>
diff --git a/features/org.eclipse.net4j.sdk-feature/feature.xml b/features/org.eclipse.net4j.sdk-feature/feature.xml
index 9acdb9fe97..755c1f5c65 100644
--- a/features/org.eclipse.net4j.sdk-feature/feature.xml
+++ b/features/org.eclipse.net4j.sdk-feature/feature.xml
@@ -12,7 +12,7 @@
<feature
id="org.eclipse.net4j.sdk"
label="%featureName"
- version="4.10.0.qualifier"
+ version="4.11.0.qualifier"
provider-name="%providerName"
image="eclipse_update_120.jpg"
license-feature="org.eclipse.emf.cdo.license"
diff --git a/features/org.eclipse.net4j.sdk-feature/pom.xml b/features/org.eclipse.net4j.sdk-feature/pom.xml
index e2df976f5e..dcb66f12be 100644
--- a/features/org.eclipse.net4j.sdk-feature/pom.xml
+++ b/features/org.eclipse.net4j.sdk-feature/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.eclipse.emf.cdo.features</groupId>
<artifactId>org.eclipse.net4j.sdk</artifactId>
- <version>4.10.0-SNAPSHOT</version>
+ <version>4.11.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>
diff --git a/features/org.eclipse.net4j.util-feature/feature.xml b/features/org.eclipse.net4j.util-feature/feature.xml
index 66c0912b84..15816a64d0 100644
--- a/features/org.eclipse.net4j.util-feature/feature.xml
+++ b/features/org.eclipse.net4j.util-feature/feature.xml
@@ -12,7 +12,7 @@
<feature
id="org.eclipse.net4j.util"
label="%featureName"
- version="4.10.0.qualifier"
+ version="4.11.0.qualifier"
provider-name="%providerName"
image="eclipse_update_120.jpg"
license-feature="org.eclipse.emf.cdo.license"
diff --git a/features/org.eclipse.net4j.util-feature/pom.xml b/features/org.eclipse.net4j.util-feature/pom.xml
index 894e0591e1..ddbd784f32 100644
--- a/features/org.eclipse.net4j.util-feature/pom.xml
+++ b/features/org.eclipse.net4j.util-feature/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.eclipse.emf.cdo.features</groupId>
<artifactId>org.eclipse.net4j.util</artifactId>
- <version>4.10.0-SNAPSHOT</version>
+ <version>4.11.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>
diff --git a/features/org.eclipse.net4j.util.ui-feature/feature.xml b/features/org.eclipse.net4j.util.ui-feature/feature.xml
index 771ec1f3fc..be081d728b 100644
--- a/features/org.eclipse.net4j.util.ui-feature/feature.xml
+++ b/features/org.eclipse.net4j.util.ui-feature/feature.xml
@@ -12,7 +12,7 @@
<feature
id="org.eclipse.net4j.util.ui"
label="%featureName"
- version="4.10.0.qualifier"
+ version="4.11.0.qualifier"
provider-name="%providerName"
image="eclipse_update_120.jpg"
license-feature="org.eclipse.emf.cdo.license"
diff --git a/features/org.eclipse.net4j.util.ui-feature/pom.xml b/features/org.eclipse.net4j.util.ui-feature/pom.xml
index fefdf01042..9c17836ca7 100644
--- a/features/org.eclipse.net4j.util.ui-feature/pom.xml
+++ b/features/org.eclipse.net4j.util.ui-feature/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.eclipse.emf.cdo.features</groupId>
<artifactId>org.eclipse.net4j.util.ui</artifactId>
- <version>4.10.0-SNAPSHOT</version>
+ <version>4.11.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>
diff --git a/plugins/org.eclipse.net4j.util/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j.util/META-INF/MANIFEST.MF
index 519798df43..9c967ad64a 100644
--- a/plugins/org.eclipse.net4j.util/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j.util/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.net4j.util;singleton:=true
-Bundle-Version: 3.11.0.qualifier
+Bundle-Version: 3.12.0.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -15,35 +15,35 @@ Import-Package: org.eclipse.osgi.service.debug;version="[1.0.0,2.0.0)";resolutio
org.osgi.framework;version="[1.3.0,2.0.0)";resolution:=optional,
org.osgi.service.log;version="[1.3.0,2.0.0)";resolution:=optional,
org.osgi.util.tracker;version="[1.3.0,2.0.0)";resolution:=optional
-Export-Package: org.eclipse.net4j.internal.util.bundle;version="3.11.0";x-friends:="org.eclipse.net4j.util.ui,org.eclipse.net4j.tests",
- org.eclipse.net4j.internal.util.container;version="3.11.0";x-internal:=true,
- org.eclipse.net4j.internal.util.factory;version="3.11.0";x-internal:=true,
- org.eclipse.net4j.internal.util.om;version="3.11.0";x-internal:=true,
- org.eclipse.net4j.internal.util.om.pref;version="3.11.0";x-internal:=true,
- org.eclipse.net4j.internal.util.table;version="3.11.0";x-internal:=true,
- org.eclipse.net4j.internal.util.test;version="3.11.0";x-friends:="org.eclipse.net4j.tests",
- org.eclipse.net4j.util;version="3.11.0",
- org.eclipse.net4j.util.cache;version="3.11.0",
- org.eclipse.net4j.util.collection;version="3.11.0",
- org.eclipse.net4j.util.concurrent;version="3.11.0",
- org.eclipse.net4j.util.confirmation;version="3.11.0",
- org.eclipse.net4j.util.container;version="3.11.0",
- org.eclipse.net4j.util.container.delegate;version="3.11.0",
- org.eclipse.net4j.util.event;version="3.11.0",
- org.eclipse.net4j.util.factory;version="3.11.0",
- org.eclipse.net4j.util.fsm;version="3.11.0",
- org.eclipse.net4j.util.io;version="3.11.0",
- org.eclipse.net4j.util.lifecycle;version="3.11.0",
- org.eclipse.net4j.util.om;version="3.11.0",
- org.eclipse.net4j.util.om.log;version="3.11.0",
- org.eclipse.net4j.util.om.monitor;version="3.11.0",
- org.eclipse.net4j.util.om.pref;version="3.11.0",
- org.eclipse.net4j.util.om.trace;version="3.11.0",
- org.eclipse.net4j.util.options;version="3.11.0",
- org.eclipse.net4j.util.properties;version="3.11.0",
- org.eclipse.net4j.util.ref;version="3.11.0",
- org.eclipse.net4j.util.registry;version="3.11.0",
- org.eclipse.net4j.util.security;version="3.11.0",
- org.eclipse.net4j.util.transaction;version="3.11.0"
+Export-Package: org.eclipse.net4j.internal.util.bundle;version="3.12.0";x-friends:="org.eclipse.net4j.util.ui,org.eclipse.net4j.tests",
+ org.eclipse.net4j.internal.util.container;version="3.12.0";x-internal:=true,
+ org.eclipse.net4j.internal.util.factory;version="3.12.0";x-internal:=true,
+ org.eclipse.net4j.internal.util.om;version="3.12.0";x-internal:=true,
+ org.eclipse.net4j.internal.util.om.pref;version="3.12.0";x-internal:=true,
+ org.eclipse.net4j.internal.util.table;version="3.12.0";x-internal:=true,
+ org.eclipse.net4j.internal.util.test;version="3.12.0";x-friends:="org.eclipse.net4j.tests",
+ org.eclipse.net4j.util;version="3.12.0",
+ org.eclipse.net4j.util.cache;version="3.12.0",
+ org.eclipse.net4j.util.collection;version="3.12.0",
+ org.eclipse.net4j.util.concurrent;version="3.12.0",
+ org.eclipse.net4j.util.confirmation;version="3.12.0",
+ org.eclipse.net4j.util.container;version="3.12.0",
+ org.eclipse.net4j.util.container.delegate;version="3.12.0",
+ org.eclipse.net4j.util.event;version="3.12.0",
+ org.eclipse.net4j.util.factory;version="3.12.0",
+ org.eclipse.net4j.util.fsm;version="3.12.0",
+ org.eclipse.net4j.util.io;version="3.12.0",
+ org.eclipse.net4j.util.lifecycle;version="3.12.0",
+ org.eclipse.net4j.util.om;version="3.12.0",
+ org.eclipse.net4j.util.om.log;version="3.12.0",
+ org.eclipse.net4j.util.om.monitor;version="3.12.0",
+ org.eclipse.net4j.util.om.pref;version="3.12.0",
+ org.eclipse.net4j.util.om.trace;version="3.12.0",
+ org.eclipse.net4j.util.options;version="3.12.0",
+ org.eclipse.net4j.util.properties;version="3.12.0",
+ org.eclipse.net4j.util.ref;version="3.12.0",
+ org.eclipse.net4j.util.registry;version="3.12.0",
+ org.eclipse.net4j.util.security;version="3.12.0",
+ org.eclipse.net4j.util.transaction;version="3.12.0"
Eclipse-BuddyPolicy: registered
Automatic-Module-Name: org.eclipse.net4j.util
diff --git a/plugins/org.eclipse.net4j.util/pom.xml b/plugins/org.eclipse.net4j.util/pom.xml
index 379473e572..eb3fd46375 100644
--- a/plugins/org.eclipse.net4j.util/pom.xml
+++ b/plugins/org.eclipse.net4j.util/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.eclipse.emf.cdo</groupId>
<artifactId>org.eclipse.net4j.util</artifactId>
- <version>3.11.0-SNAPSHOT</version>
+ <version>3.12.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/RunnableWithException.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/RunnableWithException.java
new file mode 100644
index 0000000000..50a5c9ad6a
--- /dev/null
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/RunnableWithException.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2020 Eike Stepper (Loehne, Germany) 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.util;
+
+/**
+ * An interface with a {@link #run()} method that can propagate checked exceptions.
+ *
+ * @author Eike Stepper
+ * @since 3.12
+ */
+@FunctionalInterface
+public interface RunnableWithException
+{
+ public void run() throws Exception;
+
+ public static void forkAndWait(RunnableWithException runnable) throws Exception
+ {
+ Exception[] exception = { null };
+ Thread thread = new Thread(runnable.getClass().getName())
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ runnable.run();
+ }
+ catch (Exception ex)
+ {
+ exception[0] = ex;
+ }
+ }
+ };
+
+ thread.start();
+ thread.join();
+
+ if (exception[0] != null)
+ {
+ throw exception[0];
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerPersistence.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerPersistence.java
index 66bb62c7f3..ad1523c67b 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerPersistence.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerPersistence.java
@@ -38,7 +38,6 @@ public abstract class ContainerPersistence<E> implements Persistence<E>
{
out = openInputStream();
- @SuppressWarnings("resource")
ObjectInputStream oos = new ObjectInputStream(new BufferedInputStream(out));
@SuppressWarnings("unchecked")
@@ -68,7 +67,6 @@ public abstract class ContainerPersistence<E> implements Persistence<E>
{
out = openOutputStream();
- @SuppressWarnings("resource")
ObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(out));
oos.writeObject(elements);
oos.flush();

Back to the top