analysis.lami: merge control flow on ranges equal zero
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Wed, 1 Jun 2016 19:50:11 +0000 (15:50 -0400)
committerAlexandre Montplaisir <alexmonthy@efficios.com>
Fri, 3 Jun 2016 23:05:29 +0000 (19:05 -0400)
Even thought it is the expected behaviour Coverity/Sonar flags the two
"if"s as a potential code duplication and infers an error.

Let's comply to Coverity/Sonar.

Note: Patrick Tassé did mention to merge the two "if"s during initial
review [1] and it was simply forgotten.

Coverity ID: 115874

[1] https://git.eclipse.org/r/#/c/73239/7/analysis/org.eclipse.tracecompass.analysis.lami.ui/src/org/eclipse/tracecompass/internal/provisional/analysis/lami/ui/format/LamiTimeStampFormat.java

Change-Id: I22cf9499eb53fd547ae3ebfc73161f21db5cac47
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Reviewed-on: https://git.eclipse.org/r/74314
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reviewed-by: Hudson CI
analysis/org.eclipse.tracecompass.analysis.lami.ui/src/org/eclipse/tracecompass/internal/provisional/analysis/lami/ui/format/LamiTimeStampFormat.java

index 87c607b39a00bb2a60715b3f46ce1e3b0fb63f83..05e437a9c7a4c7b39544c88a23d146c831ecace5 100644 (file)
@@ -130,11 +130,8 @@ public class LamiTimeStampFormat extends Format {
                 return checkNotNull(toAppendTo.append(fFormat.format(time)));
             }
 
-            if (internalRange.getDelta().compareTo(BigDecimal.ZERO) == 0) {
-                return checkNotNull(toAppendTo.append(fFormat.format(externalRange.getMinimum().doubleValue())));
-            }
-
-            if (externalRange.getDelta().compareTo(BigDecimal.ZERO) == 0) {
+            if (internalRange.getDelta().compareTo(BigDecimal.ZERO) == 0 ||
+                    externalRange.getDelta().compareTo(BigDecimal.ZERO) == 0) {
                 return checkNotNull(toAppendTo.append(fFormat.format(externalRange.getMinimum().doubleValue())));
             }
 
This page took 0.02667 seconds and 5 git commands to generate.