From a5dc30e14f1d9b7efc86968b2c49889d6b61b2f4 Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Wed, 31 Jul 2013 10:28:10 +0200 Subject: Fix some quality flaws --- .../batch/profiling/PhasesSumUpTimeProfiler.java | 23 +++++++++------------- .../java/org/sonar/core/purge/PurgeProfiler.java | 9 ++++----- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/sonar-batch/src/main/java/org/sonar/batch/profiling/PhasesSumUpTimeProfiler.java b/sonar-batch/src/main/java/org/sonar/batch/profiling/PhasesSumUpTimeProfiler.java index 29f4192be13..9e35c1936d0 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/profiling/PhasesSumUpTimeProfiler.java +++ b/sonar-batch/src/main/java/org/sonar/batch/profiling/PhasesSumUpTimeProfiler.java @@ -95,8 +95,7 @@ public class PhasesSumUpTimeProfiler implements ProjectAnalysisHandler, SensorEx if (event.isStart()) { decoratorsProfiler = new DecoratorsProfiler(); currentModuleProfiling = new ModuleProfiling(module, clock); - } - else { + } else { currentModuleProfiling.stop(); modulesProfilings.put(module, currentModuleProfiling); long moduleTotalTime = currentModuleProfiling.totalTime(); @@ -135,8 +134,7 @@ public class PhasesSumUpTimeProfiler implements ProjectAnalysisHandler, SensorEx public void onSensorsPhase(SensorsPhaseEvent event) { if (event.isStart()) { currentModuleProfiling.addPhaseProfiling(Phases.Phase.SENSOR); - } - else { + } else { currentModuleProfiling.getProfilingPerPhase(Phases.Phase.SENSOR).stop(); } } @@ -165,8 +163,7 @@ public class PhasesSumUpTimeProfiler implements ProjectAnalysisHandler, SensorEx public void onDecoratorsPhase(DecoratorsPhaseEvent event) { if (event.isStart()) { currentModuleProfiling.addPhaseProfiling(Phases.Phase.DECORATOR); - } - else { + } else { for (Decorator decorator : decoratorsProfiler.getDurations().keySet()) { currentModuleProfiling.getProfilingPerPhase(Phases.Phase.DECORATOR) .getProfilingPerItem(decorator).setTotalTime(decoratorsProfiler.getDurations().get(decorator)); @@ -178,8 +175,7 @@ public class PhasesSumUpTimeProfiler implements ProjectAnalysisHandler, SensorEx public void onPostJobsPhase(PostJobsPhaseEvent event) { if (event.isStart()) { currentModuleProfiling.addPhaseProfiling(Phases.Phase.POSTJOB); - } - else { + } else { currentModuleProfiling.getProfilingPerPhase(Phases.Phase.POSTJOB).stop(); } } @@ -197,8 +193,7 @@ public class PhasesSumUpTimeProfiler implements ProjectAnalysisHandler, SensorEx public void onMavenPhase(MavenPhaseEvent event) { if (event.isStart()) { currentModuleProfiling.addPhaseProfiling(Phases.Phase.MAVEN); - } - else { + } else { currentModuleProfiling.getProfilingPerPhase(Phases.Phase.MAVEN).stop(); } } @@ -234,10 +229,10 @@ public class PhasesSumUpTimeProfiler implements ProjectAnalysisHandler, SensorEx } class DecoratorsProfiler { - List decorators = Lists.newArrayList(); - Map durations = new IdentityHashMap(); - long startTime; - Decorator currentDecorator; + private List decorators = Lists.newArrayList(); + private Map durations = new IdentityHashMap(); + private long startTime; + private Decorator currentDecorator; DecoratorsProfiler() { } diff --git a/sonar-core/src/main/java/org/sonar/core/purge/PurgeProfiler.java b/sonar-core/src/main/java/org/sonar/core/purge/PurgeProfiler.java index f9c27da9bfc..218f0b48fd7 100644 --- a/sonar-core/src/main/java/org/sonar/core/purge/PurgeProfiler.java +++ b/sonar-core/src/main/java/org/sonar/core/purge/PurgeProfiler.java @@ -33,9 +33,9 @@ import java.util.Map.Entry; public class PurgeProfiler { - Map durations = new HashMap(); - long startTime; - String currentTable; + private Map durations = new HashMap(); + private long startTime; + private String currentTable; private final Clock clock; public PurgeProfiler() { @@ -90,8 +90,7 @@ public class PurgeProfiler { for (Entry item : sortedFullList) { if (i++ >= maxSize || item.getValue() == 0) { return result; - } - else { + } else { result.add(item); } } -- cgit v1.2.3