This is an automated email from the ASF dual-hosted git repository. stbischof pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/felix-dev.git
commit cb6f178f8f474f4d0c8bf0d85e18c8d3b755a871 Author: Stefan Bischof <stbisc...@bipolis.org> AuthorDate: Sat Apr 5 09:43:30 2025 +0200 [fw] use exception multi-catch Signed-off-by: Stefan Bischof <stbisc...@bipolis.org> --- .../apache/felix/framework/BundleWiringImpl.java | 22 ++++++---------------- .../java/org/apache/felix/framework/Felix.java | 6 +----- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java b/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java index f3f67d78d6..bdccaff742 100644 --- a/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java +++ b/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java @@ -1213,14 +1213,12 @@ public class BundleWiringImpl implements BundleWiring { provider = m_resolver.resolve(m_revision, pkgName); } - catch (ResolutionException ex) + catch (ResolutionException | BundleException ex) { - // Ignore this since it is likely normal. - } - catch (BundleException ex) - { - // Ignore this since it is likely the result of a resolver hook. + // ResolutionException - Ignore this since it is likely normal. + // BundleException - Ignore this since it is likely the result of a resolver hook. } + if (provider != null) { // Delegate to the provider revision. @@ -1668,11 +1666,7 @@ public class BundleWiringImpl implements BundleWiring { provider = m_resolver.resolve(m_revision, pkgName); } - catch (ResolutionException ex) - { - // Ignore this since it is likely normal. - } - catch (BundleException ex) + catch (ResolutionException | BundleException ex) { // Ignore this since it is likely the result of a resolver hook. } @@ -2792,11 +2786,7 @@ public class BundleWiringImpl implements BundleWiring .getClassLoader(BundleClassLoader.class).loadClass(name); classpath = true; } - catch (NoClassDefFoundError err) - { - // Ignore - } - catch (Exception ex) + catch (NoClassDefFoundError | Exception ex) { // Ignore } diff --git a/framework/src/main/java/org/apache/felix/framework/Felix.java b/framework/src/main/java/org/apache/felix/framework/Felix.java index d37417cc4f..0eb23f103e 100644 --- a/framework/src/main/java/org/apache/felix/framework/Felix.java +++ b/framework/src/main/java/org/apache/felix/framework/Felix.java @@ -4364,11 +4364,7 @@ public class Felix extends BundleImpl implements Framework } } } - catch (ResolutionException ex) - { - result = false; - } - catch (BundleException ex) + catch (ResolutionException | BundleException ex) { result = false; }