From b2a0fc66fd09353602c59ee3b3b383eac34784c4 Mon Sep 17 00:00:00 2001 From: Raja Kolli Date: Wed, 25 Oct 2023 08:24:37 +0000 Subject: [PATCH] fix : sonar bug --- .../repositories/CustomRestaurantRepositoryImpl.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/boot-opensearch-sample/src/main/java/com/example/opensearch/repositories/CustomRestaurantRepositoryImpl.java b/boot-opensearch-sample/src/main/java/com/example/opensearch/repositories/CustomRestaurantRepositoryImpl.java index 9024adb1d..ae54bb1aa 100644 --- a/boot-opensearch-sample/src/main/java/com/example/opensearch/repositories/CustomRestaurantRepositoryImpl.java +++ b/boot-opensearch-sample/src/main/java/com/example/opensearch/repositories/CustomRestaurantRepositoryImpl.java @@ -207,10 +207,11 @@ public SearchPage aggregateSearch( private void addDateRange(DateRangeAggregationBuilder dateRangeBuilder) { ZonedDateTime zonedDateTime = ZonedDateTime.now().withDayOfMonth(1).toLocalDate().atStartOfDay(ZoneId.of("UTC")); - dateRangeBuilder.addUnboundedTo(zonedDateTime.minusMonths(12)); - for (int i = 12; i > 0; i--) { + dateRangeBuilder.addUnboundedTo(zonedDateTime.minusMonths(12L)); + for (long i = 12; i > 0; i--) { dateRangeBuilder.addRange( - zonedDateTime.minusMonths(i), zonedDateTime.minusMonths(i - 1).minusSeconds(1)); + zonedDateTime.minusMonths(i), + zonedDateTime.minusMonths(i - 1L).minusSeconds(1L)); } dateRangeBuilder.addUnboundedFrom(zonedDateTime); }