aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2013-07-31 10:28:10 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2013-07-31 10:28:10 +0200
commita5dc30e14f1d9b7efc86968b2c49889d6b61b2f4 (patch)
treed2984fd40dc320d5205e301884e88fa3c20999b0
parentef9ec75e79af80ce5d7de774ab4c7d29f6f82e72 (diff)
downloadsonarqube-a5dc30e14f1d9b7efc86968b2c49889d6b61b2f4.tar.gz
sonarqube-a5dc30e14f1d9b7efc86968b2c49889d6b61b2f4.zip
Fix some quality flaws
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/profiling/PhasesSumUpTimeProfiler.java23
-rw-r--r--sonar-core/src/main/java/org/sonar/core/purge/PurgeProfiler.java9
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<Decorator> decorators = Lists.newArrayList();
- Map<Decorator, Long> durations = new IdentityHashMap<Decorator, Long>();
- long startTime;
- Decorator currentDecorator;
+ private List<Decorator> decorators = Lists.newArrayList();
+ private Map<Decorator, Long> durations = new IdentityHashMap<Decorator, Long>();
+ 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<String, Long> durations = new HashMap<String, Long>();
- long startTime;
- String currentTable;
+ private Map<String, Long> durations = new HashMap<String, Long>();
+ private long startTime;
+ private String currentTable;
private final Clock clock;
public PurgeProfiler() {
@@ -90,8 +90,7 @@ public class PurgeProfiler {
for (Entry<String, Long> item : sortedFullList) {
if (i++ >= maxSize || item.getValue() == 0) {
return result;
- }
- else {
+ } else {
result.add(item);
}
}