diff options
author | Eike Stepper | 2013-03-08 10:48:38 +0000 |
---|---|---|
committer | Eike Stepper | 2013-03-08 10:48:38 +0000 |
commit | c359069dd7114dd2ab4038bae89c5f42350cb885 (patch) | |
tree | 4a242e816f83de8de718a33668bc242a586f64fe /plugins/org.eclipse.net4j.util/src | |
parent | f2879b592ade925aa9b793a36e3884efc63e52ba (diff) | |
download | cdo-c359069dd7114dd2ab4038bae89c5f42350cb885.tar.gz cdo-c359069dd7114dd2ab4038bae89c5f42350cb885.tar.xz cdo-c359069dd7114dd2ab4038bae89c5f42350cb885.zip |
[401763] Make CDO Server more robust against data dictionary changes
https://bugs.eclipse.org/bugs/show_bug.cgi?id=401763
Diffstat (limited to 'plugins/org.eclipse.net4j.util/src')
-rw-r--r-- | plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ObjectUtil.java | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ObjectUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ObjectUtil.java index b2572ea3ce..988468aa64 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ObjectUtil.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ObjectUtil.java @@ -4,19 +4,21 @@ * 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; +import org.eclipse.net4j.util.collection.Closeable; + import java.lang.reflect.Array; import java.util.Collection; import java.util.Map; /** * Various static helper methods. - * + * * @author Eike Stepper */ public final class ObjectUtil @@ -47,7 +49,7 @@ public final class ObjectUtil /** * A collision-free hash code for small sets (<=4) of small, positive integers (<=128) - * + * * @since 3.2 */ public static int hashCode(int... values) @@ -107,4 +109,30 @@ public final class ObjectUtil { return string == null || string.length() == 0; } + + /** + * @since 3.3 + */ + public static Exception close(Object object) + { + try + { + if (object instanceof Closeable) + { + Closeable closeable = (Closeable)object; + closeable.close(); + } + else if (object instanceof java.io.Closeable) + { + java.io.Closeable closeable = (java.io.Closeable)object; + closeable.close(); + } + } + catch (Exception ex) + { + return ex; + } + + return null; + } } |