Skip to content

Commit

Permalink
tmf: Fix HistogramDataProvider index OOB
Browse files Browse the repository at this point in the history
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 <adam.wendelin@ericsson.com>
  • Loading branch information
awendelin-work authored and MatthewKhouzam committed Jan 6, 2025
1 parent a6eb70c commit a7673d5
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ public TmfModelResponse<TmfTreeModel<TmfTreeDataModel>> fetchTree(Map<String, Ob
final ITmfStatistics stats = Objects.requireNonNull(fModule.getStatistics());
if (selected.contains(fTotalId)) {
List<Long> 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);
Expand Down

0 comments on commit a7673d5

Please sign in to comment.