From 3df0446623e01a7ffa16f1d880f5a35cc2b05b77 Mon Sep 17 00:00:00 2001 From: Patrick Tasse Date: Wed, 6 Jan 2016 18:38:17 -0500 Subject: [PATCH] ss: Bug 485304: Incorrect interval returned in history tree full query Change-Id: Ic68f991a168d5156a2d7a22dbc62b63b307f432f Signed-off-by: Patrick Tasse Reviewed-on: https://git.eclipse.org/r/63687 Reviewed-by: Alexandre Montplaisir Reviewed-by: Hudson CI --- .../core/backend/historytree/HTNode.java | 30 +++++++------------ 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HTNode.java b/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HTNode.java index 5a44cfd333..b006d190af 100644 --- a/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HTNode.java +++ b/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HTNode.java @@ -537,25 +537,17 @@ public abstract class HTNode { */ index = -index - 1; - } - - /* Sometimes binarySearch yields weird stuff... */ - if (index < 0) { - index = 0; - } - if (index >= fIntervals.size()) { - index = fIntervals.size() - 1; - } - - /* - * Another API quirkiness, the returned index is the one of the *last* - * element of a series of equal endtimes, which happens sometimes. We - * want the *first* element of such a series, to read through them - * again. - */ - while (index > 0 - && fIntervals.get(index - 1).compareTo(fIntervals.get(index)) == 0) { - index--; + } else { + /* + * Another API quirkiness, the returned index is the one of the *last* + * element of a series of equal endtimes, which happens sometimes. We + * want the *first* element of such a series, to read through them + * again. + */ + while (index > 0 + && fIntervals.get(index - 1).compareTo(fIntervals.get(index)) == 0) { + index--; + } } return index; -- 2.34.1