tmf: Bug 510144: IndexOutOfBoundsException in CallStackView
authorPatrick Tasse <patrick.tasse@gmail.com>
Mon, 9 Jan 2017 21:41:02 +0000 (16:41 -0500)
committerPatrick Tasse <patrick.tasse@gmail.com>
Tue, 10 Jan 2017 20:22:18 +0000 (15:22 -0500)
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 <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/88304
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-by: Hudson CI
Reviewed-by: Jean-Christian Kouame <jean-christian.kouame@ericsson.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackView.java

index c5a5eae7adc4e8e3e0e3a7ae020a3e587422de8f..b08c2c385ddb2d4b8921cdd25c286434575cca54 100644 (file)
@@ -584,9 +584,11 @@ public class CallStackView extends AbstractTimeGraphView {
             }
 
             try {
-                List<ITmfStateInterval> endStates = ss.queryFullState(ss.getCurrentEndTime());
-
+                /*
+                 * Get quarks first to make sure they are in the full query result.
+                 */
                 List<Integer> processQuarks = ss.getQuarks(module.getProcessesPattern());
+                List<ITmfStateInterval> 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();
This page took 0.026279 seconds and 5 git commands to generate.