Skip to content

Commit

Permalink
Fix IndexOutOfBoundsException in aggregator function (openhab#11113)
Browse files Browse the repository at this point in the history
Signed-off-by: Anders Alfredsson <andersb86@gmail.com>
Signed-off-by: Thomas <thomas@knaller.info>
  • Loading branch information
pacive authored and Thomas committed Sep 2, 2021
1 parent 03c613f commit 021c45b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions bundles/org.openhab.binding.smhi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ The complete channel identifier is the channel group id (`hour_<offset>` or `day
or the number of hours/days from now) + the channel id, concatenated with a `#`.

Examples:

* Temperature for the current hour: `hour_0#t`
* Total precipitation 3 days from now: `day_3#ptotal`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ public static Optional<BigDecimal> min(TimeSeries timeSeries, int dayOffset, Str
*/
public static Optional<BigDecimal> total(TimeSeries timeSeries, int dayOffset, String parameter) {
List<Forecast> dayForecasts = timeSeries.getDay(dayOffset);
if (dayForecasts.size() == 1) {
return dayForecasts.get(0).getParameter(parameter);
}
List<BigDecimal> values = new ArrayList<>();
for (int i = 0; i < dayForecasts.size(); i++) {
Forecast current = dayForecasts.get(i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ private void waitForForecast() {
} catch (RuntimeException e) {
logger.warn("Unexpected exception occurred, please report to the developers: {}: {}", e.getClass(),
e.getMessage());
logger.debug("Details: ", e);
}
}

Expand Down

0 comments on commit 021c45b

Please sign in to comment.