Skip to content

Commit 5ac9920

Browse files
Ofbiz 13374 Fixed: incorrect Groovy range iteration that was causing index out of bounds (#1177)
Fixed: proper parenthesised based iteration to avoid precedence issue that leads to invalid index access. --------- Co-authored-by: Ankit Joshi <ankitjoshi@Ankit-Joshi.local> Co-authored-by: Jacques Le Roux <jacques.le.roux@les7arts.com> Thanks Ankit!
1 parent e5e2f56 commit 5ac9920

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

applications/product/src/main/groovy/org/apache/ofbiz/product/catalog/imagemanagement/ImageRecentlyApproved.groovy

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
*/
1919
package org.apache.ofbiz.product.catalog.imagemanagement
2020

21-
import org.apache.ofbiz.entity.GenericValue
22-
import org.apache.ofbiz.entity.condition.EntityCondition
23-
import org.apache.ofbiz.entity.condition.EntityOperator
24-
2521
import java.sql.Timestamp
2622
import java.text.SimpleDateFormat
2723
import java.time.LocalDateTime
2824
import java.time.format.DateTimeFormatter
2925

26+
import org.apache.ofbiz.entity.GenericValue
27+
import org.apache.ofbiz.entity.condition.EntityCondition
28+
import org.apache.ofbiz.entity.condition.EntityOperator
29+
3030
int limit = 13 // set number of days
3131
DateTimeFormatter sdf = DateTimeFormatter.ofPattern('yyyy-MM-dd HH:mm:ss')
3232
DateTimeFormatter sdf2 = DateTimeFormatter.ofPattern('EEEE dd/MM/yyyy', locale)
@@ -55,7 +55,7 @@ for (i in 0..limit) {
5555

5656
List time = []
5757
if (tempTimeList.size > 0) {
58-
0..tempTimeList.size - 1.each { j ->
58+
(0..tempTimeList.size - 1).each { j ->
5959
time.add(sdfTime.format(tempTimeList.get(j).get(0)))
6060
}
6161
}

0 commit comments

Comments
 (0)