diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2015-06-02 15:52:17 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2015-06-02 15:52:54 +0200 |
commit | 4490f3161107ad197c736125c2ca551a1525c7d8 (patch) | |
tree | 579cac439422248fa2edba15726c8e48b1435254 /sonar-batch | |
parent | d1f748709d8312572fe1b75bb6333bc70ef4fe48 (diff) | |
download | sonarqube-4490f3161107ad197c736125c2ca551a1525c7d8.tar.gz sonarqube-4490f3161107ad197c736125c2ca551a1525c7d8.zip |
Fix NPE when using ProjectBuilder + sonar.showProfilingLevel=true
Diffstat (limited to 'sonar-batch')
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/scan/ProjectBuildersExecutor.java | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectBuildersExecutor.java b/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectBuildersExecutor.java index ac15206c6f3..1a43bcac39a 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectBuildersExecutor.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectBuildersExecutor.java @@ -22,35 +22,33 @@ package org.sonar.batch.scan; import org.sonar.api.batch.bootstrap.ProjectBuilder; import org.sonar.api.batch.bootstrap.ProjectReactor; import org.sonar.api.batch.bootstrap.internal.ProjectBuilderContext; -import org.sonar.batch.events.BatchStepEvent; -import org.sonar.batch.events.EventBus; - -import javax.annotation.Nullable; +import org.sonar.api.utils.log.Logger; +import org.sonar.api.utils.log.Loggers; +import org.sonar.api.utils.log.Profiler; public class ProjectBuildersExecutor { + private static final Logger LOG = Loggers.get(ProjectBuildersExecutor.class); + private final ProjectBuilder[] projectBuilders; - private final EventBus eventBus; - public ProjectBuildersExecutor(EventBus eventBus, @Nullable ProjectBuilder... projectBuilders) { - this.eventBus = eventBus; + public ProjectBuildersExecutor(ProjectBuilder... projectBuilders) { this.projectBuilders = projectBuilders; } - public ProjectBuildersExecutor(EventBus eventBus) { - this(eventBus, new ProjectBuilder[0]); + public ProjectBuildersExecutor() { + this(new ProjectBuilder[0]); } public void execute(ProjectReactor reactor) { if (projectBuilders.length > 0) { - String stepName = "Execute project builders"; - eventBus.fireEvent(new BatchStepEvent(stepName, true)); + Profiler profiler = Profiler.create(LOG).startInfo("Execute project builders"); ProjectBuilderContext context = new ProjectBuilderContext(reactor); for (ProjectBuilder projectBuilder : projectBuilders) { projectBuilder.build(context); } - eventBus.fireEvent(new BatchStepEvent(stepName, false)); + profiler.stopInfo(); } } } |