This is an automated email from the ASF dual-hosted git repository. mattsicker pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit d9867903cba8cabcad832baa99f66797e5c3f2a7 Author: Matt Sicker <[email protected]> AuthorDate: Sat Nov 5 13:20:51 2022 -0500 Revert "Catch ServiceConfigurationError in OSGi service loading" This reverts commit 2a03c3c6348698438293ad22177789d1997c2ba6. --- .../apache/logging/log4j/util3/ServiceRegistry.java | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util3/ServiceRegistry.java b/log4j-api/src/main/java/org/apache/logging/log4j/util3/ServiceRegistry.java index af57a6adc9..f493c6110e 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/util3/ServiceRegistry.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/util3/ServiceRegistry.java @@ -104,22 +104,8 @@ public class ServiceRegistry { public <S> void loadServicesFromBundle( final Class<S> serviceType, final long bundleId, final ClassLoader bundleClassLoader) { final List<S> services = new ArrayList<>(); - try { - final ServiceLoader<S> serviceLoader = ServiceLoader.load(serviceType, bundleClassLoader); - final Iterator<S> iterator = serviceLoader.iterator(); - while (iterator.hasNext()) { - try { - services.add(iterator.next()); - } catch (final ServiceConfigurationError sce) { - final String message = String.format("Unable to load %s service in bundle id %d", - serviceType.getName(), bundleId); - LowLevelLogUtil.logException(message, sce); - } - } - } catch (final ServiceConfigurationError e) { - final String message = String.format("Unable to load any %s services in bundle id %d", - serviceType.getName(), bundleId); - LowLevelLogUtil.logException(message, e); + for (final S service : ServiceLoader.load(serviceType, bundleClassLoader)) { + services.add(service); } registerBundleServices(serviceType, bundleId, services); }
