From 91ba906c58bba1d4991133bdf2641a87b26f44cb Mon Sep 17 00:00:00 2001 From: Patrick Tasse Date: Mon, 9 Jan 2017 16:41:02 -0500 Subject: [PATCH] tmf: Bug 510144: IndexOutOfBoundsException in CallStackView Get the quarks list before doing the full query, and when accessing the full query result later, do a bounds check and redo the full query if necessary. Change-Id: Ica9ab6d414fb2286ad41deceff0b2be911be64d9 Signed-off-by: Patrick Tasse Reviewed-on: https://git.eclipse.org/r/88304 Reviewed-by: Matthew Khouzam Reviewed-by: Hudson CI Reviewed-by: Jean-Christian Kouame Tested-by: Matthew Khouzam --- .../tmf/ui/views/callstack/CallStackView.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackView.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackView.java index c5a5eae7ad..b08c2c385d 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackView.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackView.java @@ -584,9 +584,11 @@ public class CallStackView extends AbstractTimeGraphView { } try { - List endStates = ss.queryFullState(ss.getCurrentEndTime()); - + /* + * Get quarks first to make sure they are in the full query result. + */ List processQuarks = ss.getQuarks(module.getProcessesPattern()); + List endStates = ss.queryFullState(end); for (int processQuark : processQuarks) { /* @@ -635,6 +637,10 @@ public class CallStackView extends AbstractTimeGraphView { int callStackQuark = ss.getQuarkRelative(threadQuark, callStackPath); String threadName = ss.getAttributeName(threadQuark); long threadEnd = end + 1; + if (callStackQuark >= endStates.size()) { + /* attribute created after previous full query */ + endStates = ss.queryFullState(end); + } ITmfStateInterval endInterval = endStates.get(callStackQuark); if (endInterval.getStateValue().isNull() && endInterval.getStartTime() != ss.getStartTime()) { threadEnd = endInterval.getStartTime(); @@ -646,10 +652,15 @@ public class CallStackView extends AbstractTimeGraphView { if (threadQuark != processQuark) { ThreadEntry threadEntry = threadEntryMap.get(threadQuark); if (threadEntry == null) { - if (startStates == null) { + if (startStates == null || callStackQuark >= startStates.size()) { + /* attribute created after previous full query */ startStates = ss.queryFullState(ss.getStartTime()); } long threadId = -1; + if (threadQuark >= endStates.size()) { + /* attribute created after previous full query */ + endStates = ss.queryFullState(end); + } ITmfStateValue threadStateValue = endStates.get(threadQuark).getStateValue(); if (threadStateValue.getType() == Type.LONG || threadStateValue.getType() == Type.INTEGER) { threadId = threadStateValue.unboxLong(); -- 2.34.1