From dd1f7945b12b787c2f2b6726656734d045ae9c8f Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Fri, 12 Aug 2011 12:06:40 +0200 Subject: [PATCH] SONAR-2692 allow ExtensionProvider#provide() to return null --- .../batch/bootstrap/BatchExtensionInstaller.java | 12 +++++++----- .../plugins/DefaultServerPluginRepository.java | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchExtensionInstaller.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchExtensionInstaller.java index f91054793b8..75dec73bac8 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchExtensionInstaller.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchExtensionInstaller.java @@ -64,12 +64,14 @@ public final class BatchExtensionInstaller implements BatchComponent { List providers = module.getComponents(ExtensionProvider.class); for (ExtensionProvider provider : providers) { Object obj = provider.provide(); - if (obj instanceof Iterable) { - for (Object extension : (Iterable) obj) { - installExtension(module, extension); + if (obj != null) { + if (obj instanceof Iterable) { + for (Object extension : (Iterable) obj) { + installExtension(module, extension); + } + } else { + installExtension(module, obj); } - } else { - installExtension(module, obj); } } } diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/DefaultServerPluginRepository.java b/sonar-server/src/main/java/org/sonar/server/plugins/DefaultServerPluginRepository.java index 4776c65eeee..6506f5caf8a 100644 --- a/sonar-server/src/main/java/org/sonar/server/plugins/DefaultServerPluginRepository.java +++ b/sonar-server/src/main/java/org/sonar/server/plugins/DefaultServerPluginRepository.java @@ -135,12 +135,14 @@ public class DefaultServerPluginRepository implements ServerPluginRepository { List providers = container.getComponents(ExtensionProvider.class); for (ExtensionProvider provider : providers) { Object obj = provider.provide(); - if (obj instanceof Iterable) { - for (Object extension : (Iterable) obj) { - installExtension(container, extension); + if (obj != null) { + if (obj instanceof Iterable) { + for (Object extension : (Iterable) obj) { + installExtension(container, extension); + } + } else { + installExtension(container, obj); } - } else { - installExtension(container, obj); } } } -- 2.39.5