tmf: Fix some critical and major Sonar warnings
authorPatrick Tasse <patrick.tasse@gmail.com>
Mon, 16 Jan 2017 22:34:49 +0000 (17:34 -0500)
committerPatrick Tasse <patrick.tasse@gmail.com>
Thu, 19 Jan 2017 17:19:21 +0000 (12:19 -0500)
Security - Array is stored directly
Naming - Suspicious constant field name
Performance - Should be a static inner class

Change-Id: Ifeed507f41dd40562a8863e2847bcd39e7c44c5c
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/88797
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-by: Hudson CI
analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/analysis/os/linux/core/trace/LinuxTraceContext.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/trace/TmfTraceContext.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/TimeGraphViewer.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java

index 47fc544c65ccec87bfe2cdb8171b9d49f07da22b..00f3939bde08974c38e28ce80480ded419566d3e 100644 (file)
@@ -120,7 +120,7 @@ public class LinuxTraceContext extends TmfTraceContext {
      *
      * @since 2.2
      */
-    public class LinuxBuilder extends Builder {
+    public static class LinuxBuilder extends Builder {
         private int cpu;
         private int tid;
         private ITmfTrace trace;
index dae6723f5c06e19515deb93e0c81a8933e8e28e2..2a663e421b5648c98967a00d7be44456310a7304 100644 (file)
@@ -192,7 +192,7 @@ public class TmfTraceContext implements ITraceContextSignalHandler {
      *
      * @since 2.3
      */
-    public class Builder {
+    public static class Builder {
         private TmfTimeRange selection;
         private TmfTimeRange windowRange;
         private @Nullable IFile editorFile;
index 9cb9afb73a0c70087114da158fc3c740ce8251ca..e32c893f749fabffa643597ef5e135b796e54b7d 100644 (file)
@@ -17,6 +17,7 @@
 package org.eclipse.tracecompass.tmf.ui.widgets.timegraph;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashSet;
@@ -933,7 +934,7 @@ public class TimeGraphViewer extends Viewer implements ITimeDataProvider, IMarke
         int width = fTimeAlignedComposite.getSize().x;
         if (width == 0) {
             /* the weigths will be applied when the control is resized */
-            fWeights = weights;
+            fWeights = Arrays.copyOf(weights, weights.length);
             return;
         }
         setNameSpace(width * weights[0] / (weights[0] + weights[1]));
index 9eeb3b372588a099dd5788319dc9ba663d43bcde..59ee111f75e5eebacf888b7aa5cf51c8165d5ae2 100644 (file)
@@ -134,7 +134,7 @@ public class TimeGraphControl extends TimeGraphBaseControl
     private static final int SNAP_WIDTH = 3;
     private static final int ARROW_HOVER_MAX_DIST = 5;
 
-    private static double ARROW_RATIO = Math.sqrt(3) / 2; // base to height ratio
+    private static final double ARROW_RATIO = Math.sqrt(3) / 2; // base to height ratio
 
     private static final int NO_STATUS = -1;
     private static final int STATUS_WITHOUT_CURSOR_TIME = -2;
This page took 0.029734 seconds and 5 git commands to generate.