diff options
Diffstat (limited to 'bundles/org.eclipse.osgi/container/src/org/eclipse/osgi')
10 files changed, 17 insertions, 55 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainer.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainer.java index 0b63d1a46..319b21f5d 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainer.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainer.java @@ -1758,10 +1758,7 @@ public final class ModuleContainer implements DebugOptionsListener { // of launching or shutting down the framework adaptor.publishContainerEvent(ContainerEvent.START_LEVEL, module, null, listeners); } - } catch (Error e) { - adaptor.publishContainerEvent(ContainerEvent.ERROR, module, e, listeners); - throw e; - } catch (RuntimeException e) { + } catch (Error | RuntimeException e) { adaptor.publishContainerEvent(ContainerEvent.ERROR, module, e, listeners); throw e; } 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; diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/FrameworkExtensionInstaller.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/FrameworkExtensionInstaller.java index 66542b93e..70e43c7da 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/FrameworkExtensionInstaller.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/FrameworkExtensionInstaller.java @@ -65,13 +65,12 @@ public class FrameworkExtensionInstaller { Method result = clazz.getDeclaredMethod(name, args); result.setAccessible(true); return result; - } catch (NoSuchMethodException e) { - // do nothing look in super class below } catch (SecurityException e) { // if we do not have the permissions then we will not find the method - } catch (RuntimeException e) { + } catch (NoSuchMethodException | RuntimeException e) { + // do nothing look in super class below // have to avoid blowing up <clinit> - } + } return findMethod(clazz.getSuperclass(), name, args); } @@ -129,11 +128,9 @@ public class FrameworkExtensionInstaller { continue; try { callAddURLMethod(StorageUtil.encodeFileURL(files[i])); - } catch (InvocationTargetException e) { + } catch (InvocationTargetException | MalformedURLException e) { throw new BundleException("Error adding extension content.", e); //$NON-NLS-1$ - } catch (MalformedURLException e) { - throw new BundleException("Error adding extension content.", e); //$NON-NLS-1$ - } + } } } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/ZipBundleFile.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/ZipBundleFile.java index db62f0741..b80ed90ef 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/ZipBundleFile.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/ZipBundleFile.java @@ -235,11 +235,7 @@ public class ZipBundleFile extends BundleFile { return nested; } - } catch (IOException e) { - if (debug.DEBUG_BUNDLE_FILE) - Debug.printStackTrace(e); - generation.getBundleInfo().getStorage().getLogServices().log(EquinoxContainer.NAME, FrameworkLogEntry.ERROR, "Unable to extract content: " + generation.getRevision() + ": " + entry, e); //$NON-NLS-1$ //$NON-NLS-2$ - } catch (StorageException e) { + } catch (IOException | StorageException e) { if (debug.DEBUG_BUNDLE_FILE) Debug.printStackTrace(e); generation.getBundleInfo().getStorage().getLogServices().log(EquinoxContainer.NAME, FrameworkLogEntry.ERROR, "Unable to extract content: " + generation.getRevision() + ": " + entry, e); //$NON-NLS-1$ //$NON-NLS-2$ |