]> source.dussan.org Git - sonarqube.git/commitdiff
Fix some quality flaws
authorJulien HENRY <julien.henry@sonarsource.com>
Wed, 31 Jul 2013 08:28:10 +0000 (10:28 +0200)
committerJulien HENRY <julien.henry@sonarsource.com>
Wed, 31 Jul 2013 08:28:10 +0000 (10:28 +0200)
sonar-batch/src/main/java/org/sonar/batch/profiling/PhasesSumUpTimeProfiler.java
sonar-core/src/main/java/org/sonar/core/purge/PurgeProfiler.java

index 29f4192be133e76885de2e4b2e0592e452266201..9e35c1936d07a0c2f73562c35ef7898fe37689ac 100644 (file)
@@ -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() {
     }
index f9c27da9bfce491b489a00b07d10c8004f83d720..218f0b48fd7ea740083ac8696418560e7318c6c2 100644 (file)
@@ -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);
       }
     }