From b56b8c3ce7b52bbc1f09c83d6477dfa235461a2c Mon Sep 17 00:00:00 2001 From: Adam Wendelin Date: Fri, 20 Dec 2024 11:37:14 +0100 Subject: [PATCH] tmf: Fix HistogramDataProvider index OOB For the event statistics histogram view, the HistogramDataProvider will occasionally fail with an IndexOutOfBoundsException when its fetchXY method is called before its state-system backed statistics have been populated with attributes. Add a check to verify that the y-values provided by the statistics is is large enough for the x-values. Signed-off-by: Adam Wendelin --- .../internal/tmf/core/histogram/HistogramDataProvider.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/histogram/HistogramDataProvider.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/histogram/HistogramDataProvider.java index 5d44071c09..66cb426c51 100644 --- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/histogram/HistogramDataProvider.java +++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/histogram/HistogramDataProvider.java @@ -126,6 +126,9 @@ public TmfModelResponse> fetchTree(Map values = stats.histogramQuery(filter.getTimesRequested()); + if (values.size() < n) { + return TmfXyResponseFactory.create(TITLE, xValues, Collections.emptyList(), false); + } double[] y = new double[n]; Arrays.setAll(y, values::get);