Bug 483393 - Use multi-catch in org.eclipse.e4.core.di
Change-Id: I089d54f439ad1392b01ecc345ed306586f967056
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
diff --git a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ConstructorRequestor.java b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ConstructorRequestor.java
index d57d7dd..7f2ddc9 100644
--- a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ConstructorRequestor.java
+++ b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ConstructorRequestor.java
@@ -40,12 +40,10 @@
}
try {
result = location.newInstance(actualArgs);
- } catch (IllegalArgumentException e) {
+ } catch (IllegalArgumentException | IllegalAccessException e) {
throw new InjectionException(e);
} catch (InstantiationException e) {
throw new InjectionException("Unable to instantiate " + location, e); //$NON-NLS-1$
- } catch (IllegalAccessException e) {
- throw new InjectionException(e);
} catch (InvocationTargetException e) {
Throwable originalException = e.getCause();
// Errors such as ThreadDeath or OutOfMemoryError should not be trapped
diff --git a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/FieldRequestor.java b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/FieldRequestor.java
index 14e002b..ed83aad 100644
--- a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/FieldRequestor.java
+++ b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/FieldRequestor.java
@@ -48,9 +48,7 @@
}
try {
field.set(userObject, value);
- } catch (IllegalArgumentException e) {
- throw new InjectionException(e);
- } catch (IllegalAccessException e) {
+ } catch (IllegalArgumentException | IllegalAccessException e) {
throw new InjectionException(e);
} finally {
if (!wasAccessible)
diff --git a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/InjectorImpl.java b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/InjectorImpl.java
index 25b2112..e1f1265 100644
--- a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/InjectorImpl.java
+++ b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/InjectorImpl.java
@@ -116,9 +116,7 @@
public void inject(Object object, PrimaryObjectSupplier objectSupplier) {
try {
inject(object, objectSupplier, null);
- } catch (NoClassDefFoundError e) {
- throw new InjectionException(e);
- } catch (NoSuchMethodError e) {
+ } catch (NoClassDefFoundError | NoSuchMethodError e) {
throw new InjectionException(e);
}
}
@@ -384,9 +382,7 @@
}
}
throw new InjectionException("Could not find satisfiable constructor in " + clazz.getName()); //$NON-NLS-1$
- } catch (NoClassDefFoundError e) {
- throw new InjectionException(e);
- } catch (NoSuchMethodError e) {
+ } catch (NoClassDefFoundError | NoSuchMethodError e) {
throw new InjectionException(e);
} finally {
if (shouldDebug)
diff --git a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/MethodRequestor.java b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/MethodRequestor.java
index 075b788..98ab42d 100644
--- a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/MethodRequestor.java
+++ b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/MethodRequestor.java
@@ -54,9 +54,7 @@
}
try {
result = location.invoke(userObject, actualArgs);
- } catch (IllegalArgumentException e) {
- throw new InjectionException(e);
- } catch (IllegalAccessException e) {
+ } catch (IllegalArgumentException | IllegalAccessException e) {
throw new InjectionException(e);
} catch (InvocationTargetException e) {
Throwable originalException = e.getCause();