diff options
author | Carsten Hammer | 2019-05-08 17:43:11 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2019-05-15 06:18:48 +0000 |
commit | 1603715d7ac7f727f9d5dcc537c629e023874ab4 (patch) | |
tree | fef0f7c8e221a365e50ebfc38fc65f0807bfbffe /bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal | |
parent | 79b28df3f0c7b68970e2fe6bc9eddddab436df4f (diff) | |
download | rt.equinox.framework-1603715d7ac7f727f9d5dcc537c629e023874ab4.tar.gz rt.equinox.framework-1603715d7ac7f727f9d5dcc537c629e023874ab4.tar.xz rt.equinox.framework-1603715d7ac7f727f9d5dcc537c629e023874ab4.zip |
Join catch sections using multicatch
Change-Id: Id35c9d1f3d70f1ff4c683b88cc054213b1291a17
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
Diffstat (limited to 'bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal')
7 files changed, 10 insertions, 38 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java index b3d2b5cba..3965b2832 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java @@ -70,9 +70,7 @@ public class EquinoxContainer implements ThreadFactory, Runnable { this.equinoxConfig.getHookRegistry().initialize(); try { this.storage = Storage.createStorage(this); - } catch (IOException e) { - throw new RuntimeException("Error initializing storage.", e); //$NON-NLS-1$ - } catch (BundleException e) { + } catch (IOException | BundleException e) { throw new RuntimeException("Error initializing storage.", e); //$NON-NLS-1$ } this.packageAdmin = new PackageAdminImpl(storage.getModuleContainer()); diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/FilterImpl.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/FilterImpl.java index aaf5f4009..eb10f3b86 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/FilterImpl.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/FilterImpl.java @@ -1167,9 +1167,7 @@ public class FilterImpl implements Filter /* since Framework 1.1 */ { setAccessible(method); try { return method.invoke(null, value2.trim()); - } catch (IllegalAccessException e) { - return null; - } catch (InvocationTargetException e) { + } catch (IllegalAccessException | InvocationTargetException e) { return null; } } @@ -1185,11 +1183,7 @@ public class FilterImpl implements Filter /* since Framework 1.1 */ { setAccessible(constructor); try { return constructor.newInstance(value2.trim()); - } catch (IllegalAccessException e) { - return null; - } catch (InvocationTargetException e) { - return null; - } catch (InstantiationException e) { + } catch (IllegalAccessException | InvocationTargetException | InstantiationException e) { return null; } } while (false); diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/ModuleClassLoader.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/ModuleClassLoader.java index f056a51f9..89eaa42b7 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/ModuleClassLoader.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/ModuleClassLoader.java @@ -155,13 +155,7 @@ public abstract class ModuleClassLoader extends ClassLoader implements BundleRef if (resolve) resolveClass(clazz); return (clazz); - } catch (Error e) { - if (getDebug().DEBUG_LOADER) { - Debug.println("ModuleClassLoader[" + getBundleLoader() + "].loadClass(" + name + ") failed."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - Debug.printStackTrace(e); - } - throw e; - } catch (ClassNotFoundException e) { + } catch (Error | ClassNotFoundException e) { // If the class is not found do not try to look for it locally. // The delegate would have already done that for us. if (getDebug().DEBUG_LOADER) { diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EventAdminAdapter.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EventAdminAdapter.java index 360bd50bf..b07a9a1c5 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EventAdminAdapter.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EventAdminAdapter.java @@ -66,10 +66,7 @@ public class EventAdminAdapter implements ServiceTrackerCustomizer<Object, Objec if (eventAdmin != null && logEventHandlers > 0 && logListener == null) { try { logListener = new EventAdminLogListener(context.getService(eventAdmin)); - } catch (ClassNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (NoSuchMethodException e) { + } catch (ClassNotFoundException | NoSuchMethodException e) { // TODO Auto-generated catch block e.printStackTrace(); } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EventAdminLogListener.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EventAdminLogListener.java index 5f20cbc9a..fb752e0be 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EventAdminLogListener.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EventAdminLogListener.java @@ -73,10 +73,7 @@ public class EventAdminLogListener implements SynchronousLogListener { throw (Error) t; // unexpected throw new RuntimeException(e); - } catch (IllegalAccessException e) { - // unexpected - throw new RuntimeException(e); - } catch (InstantiationException e) { + } catch (IllegalAccessException | InstantiationException e) { // unexpected throw new RuntimeException(e); } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogReaderServiceFactory.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogReaderServiceFactory.java index de227b7ca..620e31ba1 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogReaderServiceFactory.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogReaderServiceFactory.java @@ -82,12 +82,9 @@ public class ExtendedLogReaderServiceFactory implements ServiceFactory<ExtendedL static boolean safeIsLoggable(LogFilter filter, Bundle bundle, String name, int level) { try { return filter.isLoggable(bundle, name, level); - } catch (RuntimeException e) { + } catch (RuntimeException | LinkageError e) { // "listener.logged" calls user code and might throw an unchecked exception // we catch the error here to gather information on where the problem occurred. - getErrorStream().println("LogFilter.isLoggable threw a non-fatal unchecked exception as follows:"); //$NON-NLS-1$ - e.printStackTrace(getErrorStream()); - } catch (LinkageError e) { // Catch linkage errors as these are generally recoverable but let other Errors propagate (see bug 222001) getErrorStream().println("LogFilter.isLoggable threw a non-fatal unchecked exception as follows:"); //$NON-NLS-1$ e.printStackTrace(getErrorStream()); @@ -109,16 +106,13 @@ public class ExtendedLogReaderServiceFactory implements ServiceFactory<ExtendedL static void safeLogged(LogListener listener, LogEntry logEntry) { try { listener.logged(logEntry); - } catch (RuntimeException e) { + } catch (RuntimeException | LinkageError e) { // "listener.logged" calls user code and might throw an unchecked exception // we catch the error here to gather information on where the problem occurred. - getErrorStream().println("LogListener.logged threw a non-fatal unchecked exception as follows:"); //$NON-NLS-1$ - e.printStackTrace(getErrorStream()); - } catch (LinkageError e) { // Catch linkage errors as these are generally recoverable but let other Errors propagate (see bug 222001) getErrorStream().println("LogListener.logged threw a non-fatal unchecked exception as follows:"); //$NON-NLS-1$ e.printStackTrace(getErrorStream()); - } + } } public ExtendedLogReaderServiceFactory(int maxHistory, LogLevel defaultLevel) { diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedBundleHook.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedBundleHook.java index 7d8091c92..913d60a11 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedBundleHook.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedBundleHook.java @@ -173,9 +173,7 @@ public class SignedBundleHook implements ActivatorHookFactory, BundleFileWrapper return new BundleFileWrapper(signedBaseFile); } } - } catch (IOException e) { - log("Bad bundle file: " + bundleFile.getBaseFile(), FrameworkLogEntry.WARNING, e); //$NON-NLS-1$ - } catch (GeneralSecurityException e) { + } catch (IOException | GeneralSecurityException e) { log("Bad bundle file: " + bundleFile.getBaseFile(), FrameworkLogEntry.WARNING, e); //$NON-NLS-1$ } return null; |