From: Simon Brandhof Date: Fri, 12 Aug 2011 10:06:40 +0000 (+0200) Subject: SONAR-2692 allow ExtensionProvider#provide() to return null X-Git-Tag: 2.11^2~167 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=dd1f7945b12b787c2f2b6726656734d045ae9c8f;p=sonarqube.git SONAR-2692 allow ExtensionProvider#provide() to return null --- 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); } } }