diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-02-23 22:32:31 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-02-23 23:14:33 +0100 |
commit | 2bc4e191083b996abf80bcbc535064bce6881bed (patch) | |
tree | 4a02095468a96e08ff6fa1bba3ff8a869a223546 /sonar-batch | |
parent | 0654ad1cdeb80e447b050bc0b8d67724d1d2531c (diff) | |
download | sonarqube-2bc4e191083b996abf80bcbc535064bce6881bed.tar.gz sonarqube-2bc4e191083b996abf80bcbc535064bce6881bed.zip |
Fix quality flaws
Diffstat (limited to 'sonar-batch')
4 files changed, 27 insertions, 33 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/InitializersExecutor.java b/sonar-batch/src/main/java/org/sonar/batch/phases/InitializersExecutor.java index b6d1de32299..2297dba07f4 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/phases/InitializersExecutor.java +++ b/sonar-batch/src/main/java/org/sonar/batch/phases/InitializersExecutor.java @@ -21,11 +21,11 @@ package org.sonar.batch.phases; import com.google.common.collect.Lists; import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.sonar.api.batch.Initializer; import org.sonar.api.resources.Project; -import org.sonar.api.utils.TimeProfiler; +import org.sonar.api.utils.log.Logger; +import org.sonar.api.utils.log.Loggers; +import org.sonar.api.utils.log.Profiler; import org.sonar.batch.bootstrap.BatchExtensionDictionnary; import org.sonar.batch.events.EventBus; @@ -33,7 +33,7 @@ import java.util.Collection; public class InitializersExecutor { - private static final Logger LOG = LoggerFactory.getLogger(SensorsExecutor.class); + private static final Logger LOG = Loggers.get(SensorsExecutor.class); private Project project; private BatchExtensionDictionnary selector; @@ -55,9 +55,9 @@ public class InitializersExecutor { for (Initializer initializer : initializers) { eventBus.fireEvent(new InitializerExecutionEvent(initializer, true)); - TimeProfiler profiler = new TimeProfiler(LOG).start("Initializer " + initializer); + Profiler profiler = Profiler.create(LOG).startInfo("Initializer " + initializer); initializer.execute(project); - profiler.stop(); + profiler.stopInfo(); eventBus.fireEvent(new InitializerExecutionEvent(initializer, false)); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/PhasesTimeProfiler.java b/sonar-batch/src/main/java/org/sonar/batch/phases/PhasesTimeProfiler.java index 05eda79a065..612e4d49d5a 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/phases/PhasesTimeProfiler.java +++ b/sonar-batch/src/main/java/org/sonar/batch/phases/PhasesTimeProfiler.java @@ -22,14 +22,14 @@ package org.sonar.batch.phases; import com.google.common.collect.Lists; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.SystemUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.sonar.api.batch.Decorator; import org.sonar.api.batch.events.DecoratorExecutionHandler; import org.sonar.api.batch.events.DecoratorsPhaseHandler; import org.sonar.api.batch.events.SensorExecutionHandler; import org.sonar.api.batch.events.SensorsPhaseHandler; -import org.sonar.api.utils.TimeProfiler; +import org.sonar.api.utils.log.Logger; +import org.sonar.api.utils.log.Loggers; +import org.sonar.api.utils.log.Profiler; import java.util.IdentityHashMap; import java.util.List; @@ -37,9 +37,9 @@ import java.util.Map; public class PhasesTimeProfiler implements SensorExecutionHandler, DecoratorExecutionHandler, DecoratorsPhaseHandler, SensorsPhaseHandler { - private static final Logger LOG = LoggerFactory.getLogger(PhasesTimeProfiler.class); + private static final Logger LOG = Loggers.get(PhasesTimeProfiler.class); - private TimeProfiler profiler = new TimeProfiler(LOG); + private Profiler profiler = Profiler.create(LOG); private DecoratorsProfiler decoratorsProfiler = new DecoratorsProfiler(); @Override @@ -52,9 +52,9 @@ public class PhasesTimeProfiler implements SensorExecutionHandler, DecoratorExec @Override public void onSensorExecution(SensorExecutionEvent event) { if (event.isStart()) { - profiler.start("Sensor " + event.getSensor()); + profiler.startInfo("Sensor " + event.getSensor()); } else { - profiler.stop(); + profiler.stopInfo(); } } diff --git a/sonar-batch/src/main/java/org/sonar/batch/repository/GlobalRepositoriesProvider.java b/sonar-batch/src/main/java/org/sonar/batch/repository/GlobalRepositoriesProvider.java index 6f13f3878de..ba8dc3c7542 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/repository/GlobalRepositoriesProvider.java +++ b/sonar-batch/src/main/java/org/sonar/batch/repository/GlobalRepositoriesProvider.java @@ -20,25 +20,22 @@ package org.sonar.batch.repository; import org.picocontainer.injectors.ProviderAdapter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.sonar.api.utils.TimeProfiler; +import org.sonar.api.utils.log.Logger; +import org.sonar.api.utils.log.Loggers; +import org.sonar.api.utils.log.Profiler; import org.sonar.batch.protocol.input.GlobalRepositories; public class GlobalRepositoriesProvider extends ProviderAdapter { - private static final Logger LOG = LoggerFactory.getLogger(GlobalRepositoriesProvider.class); + private static final Logger LOG = Loggers.get(GlobalRepositoriesProvider.class); private GlobalRepositories globalReferentials; public GlobalRepositories provide(GlobalRepositoriesLoader loader) { if (globalReferentials == null) { - TimeProfiler profiler = new TimeProfiler(LOG).start("Load global repositories"); - try { - globalReferentials = loader.load(); - } finally { - profiler.stop(); - } + Profiler profiler = Profiler.create(LOG).startInfo("Load global repositories"); + globalReferentials = loader.load(); + profiler.stopInfo(); } return globalReferentials; } diff --git a/sonar-batch/src/main/java/org/sonar/batch/repository/ProjectRepositoriesProvider.java b/sonar-batch/src/main/java/org/sonar/batch/repository/ProjectRepositoriesProvider.java index e69386ec498..283beec595f 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/repository/ProjectRepositoriesProvider.java +++ b/sonar-batch/src/main/java/org/sonar/batch/repository/ProjectRepositoriesProvider.java @@ -20,28 +20,25 @@ package org.sonar.batch.repository; import org.picocontainer.injectors.ProviderAdapter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.sonar.api.batch.AnalysisMode; import org.sonar.api.batch.bootstrap.ProjectReactor; -import org.sonar.api.utils.TimeProfiler; +import org.sonar.api.utils.log.Logger; +import org.sonar.api.utils.log.Loggers; +import org.sonar.api.utils.log.Profiler; import org.sonar.batch.bootstrap.TaskProperties; import org.sonar.batch.protocol.input.ProjectRepositories; public class ProjectRepositoriesProvider extends ProviderAdapter { - private static final Logger LOG = LoggerFactory.getLogger(ProjectRepositoriesProvider.class); + private static final Logger LOG = Loggers.get(ProjectRepositoriesProvider.class); private ProjectRepositories projectReferentials; public ProjectRepositories provide(ProjectRepositoriesLoader loader, ProjectReactor reactor, TaskProperties taskProps, AnalysisMode analysisMode) { if (projectReferentials == null) { - TimeProfiler profiler = new TimeProfiler(LOG).start("Load project repositories"); - try { - projectReferentials = loader.load(reactor, taskProps); - } finally { - profiler.stop(); - } + Profiler profiler = Profiler.create(LOG).startInfo("Load project repositories"); + projectReferentials = loader.load(reactor, taskProps); + profiler.stopInfo(); if (analysisMode.isPreview() && projectReferentials.lastAnalysisDate() == null) { LOG.warn("No analysis has been found on the server for this project. All issues will be marked as 'new'."); } |