diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/reports/SalesInvoiceByProductCategorySummary.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/reports/SalesInvoiceByProductCategorySummary.groovy index 0bcb833f374..2bcd1a606f3 100644 --- a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/reports/SalesInvoiceByProductCategorySummary.groovy +++ b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/reports/SalesInvoiceByProductCategorySummary.groovy @@ -120,8 +120,7 @@ for (int currentDay = 0; currentDay <= daysInMonth; currentDay++) { productResultListIterator = select('productId', 'quantityTotal', 'amountTotal') .from('InvoiceItemProductSummary').where(productAndExprs).cursorScrollInsensitive().cache(true).queryIterator() productResultMap = [:] - while (productResultListIterator.hasNext()) { - productResult = productResultListIterator.next() + while ((productResult = productResultListIterator.next()) != null) { productResultMap[productResult.productId] = productResult monthProductResult = UtilMisc.getMapFromMap(monthProductResultMap, productResult.productId) UtilMisc.addToBigDecimalInMap(monthProductResult, 'quantityTotal', productResult.getBigDecimal('quantityTotal')) @@ -139,8 +138,7 @@ for (int currentDay = 0; currentDay <= daysInMonth; currentDay++) { categoryResultListIterator = select('productCategoryId', 'quantityTotal', 'amountTotal') .from('InvoiceItemCategorySummary').where(categoryAndExprs).cursorScrollInsensitive().cache(true).queryIterator() categoryResultMap = [:] - while (categoryResultListIterator.hasNext()) { - categoryResult = categoryResultListIterator.next() + while ((categoryResult = categoryResultListIterator.next()) != null) { categoryResultMap[categoryResult.productCategoryId] = categoryResult monthCategoryResult = UtilMisc.getMapFromMap(monthCategoryResultMap, categoryResult.productCategoryId) UtilMisc.addToBigDecimalInMap(monthCategoryResult, 'quantityTotal', categoryResult.getBigDecimal('quantityTotal')) diff --git a/applications/order/src/main/groovy/org/apache/ofbiz/order/entry/StorePaymentOptions.groovy b/applications/order/src/main/groovy/org/apache/ofbiz/order/entry/StorePaymentOptions.groovy index ab3c0f4f3d2..e8d9f0033b8 100644 --- a/applications/order/src/main/groovy/org/apache/ofbiz/order/entry/StorePaymentOptions.groovy +++ b/applications/order/src/main/groovy/org/apache/ofbiz/order/entry/StorePaymentOptions.groovy @@ -25,8 +25,7 @@ productStore = ProductStoreWorker.getProductStore(request) productStorePaymentMethodTypeIdMap = [:] productStorePaymentSettingList = productStore.getRelated('ProductStorePaymentSetting', null, null, true) productStorePaymentSettingIter = productStorePaymentSettingList.iterator() -while (productStorePaymentSettingIter.hasNext()) { - productStorePaymentSetting = productStorePaymentSettingIter.next() +while ((productStorePaymentSetting = productStorePaymentSettingIter.next()) != null) { productStorePaymentMethodTypeIdMap.put(productStorePaymentSetting.get('paymentMethodTypeId'), true) } context.put('productStorePaymentMethodTypeIdMap', productStorePaymentMethodTypeIdMap) diff --git a/applications/product/src/main/groovy/org/apache/ofbiz/product/catalog/FastLoadCache.groovy b/applications/product/src/main/groovy/org/apache/ofbiz/product/catalog/FastLoadCache.groovy index 7c376904211..1c96ed01efc 100644 --- a/applications/product/src/main/groovy/org/apache/ofbiz/product/catalog/FastLoadCache.groovy +++ b/applications/product/src/main/groovy/org/apache/ofbiz/product/catalog/FastLoadCache.groovy @@ -31,8 +31,7 @@ messageList.add(ctimer.timerString('Before load all categories into cache')) category = null long numCategories = 0 -while (categories.hasNext()) { - category = (GenericValue) categories.next() +while ((category = (GenericValue) categories.next()) != null) { delegator.putInPrimaryKeyCache(category.getPrimaryKey(), category) numCategories++ } @@ -50,8 +49,7 @@ products = from('Product').queryIterator() messageList.add(ptimer.timerString('Before load all products into cache')) product = null long numProducts = 0 -while (products.hasNext()) { - product = (GenericValue) products.next() +while ((product = (GenericValue) products.next()) != null) { delegator.putInPrimaryKeyCache(product.getPrimaryKey(), product) numProducts++ } diff --git a/applications/product/src/main/groovy/org/apache/ofbiz/product/facility/facility/CountFacilityInventoryByProduct.groovy b/applications/product/src/main/groovy/org/apache/ofbiz/product/facility/facility/CountFacilityInventoryByProduct.groovy index 5d79186284d..4a69b65b38f 100644 --- a/applications/product/src/main/groovy/org/apache/ofbiz/product/facility/facility/CountFacilityInventoryByProduct.groovy +++ b/applications/product/src/main/groovy/org/apache/ofbiz/product/facility/facility/CountFacilityInventoryByProduct.groovy @@ -322,8 +322,7 @@ if (action) { // attempt to get the full size if (hasOffsetQOH || hasOffsetATP) { rowProcessed = 0 - while (prodsEli.hasNext()) { - nextValue = prodsEli.next() + while ((nextValue = prodsEli.next()) != null) { offsetQOHQtyAvailable = nextValue.getDouble('offsetQOHQtyAvailable') offsetATPQtyAvailable = nextValue.getDouble('offsetATPQtyAvailable') if (hasOffsetATP) { diff --git a/applications/product/src/main/groovy/org/apache/ofbiz/product/facility/shipment/PackingSlip.groovy b/applications/product/src/main/groovy/org/apache/ofbiz/product/facility/shipment/PackingSlip.groovy index 88c692c4f40..5a8caa4d331 100644 --- a/applications/product/src/main/groovy/org/apache/ofbiz/product/facility/shipment/PackingSlip.groovy +++ b/applications/product/src/main/groovy/org/apache/ofbiz/product/facility/shipment/PackingSlip.groovy @@ -59,8 +59,7 @@ previousShipmentIter = from('Shipment') EntityOperator.AND)) .queryIterator() -while (previousShipmentIter.hasNext()) { - previousShipmentItem = previousShipmentIter.next() +while ((previousShipmentItem = previousShipmentIter.next()) != null) { if (previousShipmentItem.shipmentId != shipment.shipmentId) { previousShipmentItems = previousShipmentItem.getRelated('ShipmentItem', null, null, false) previousShipmentItems.each { shipmentItem -> diff --git a/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/entity/XmlDsDump.groovy b/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/entity/XmlDsDump.groovy index a11e903cb8e..59d8367fe82 100644 --- a/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/entity/XmlDsDump.groovy +++ b/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/entity/XmlDsDump.groovy @@ -220,8 +220,7 @@ if (passedEntityNames) { } curNumberWritten = 0 - while (values.hasNext()) { - value = values.next() + while ((value = values.next()) != null) { value.writeXmlText(writer, '') numberWritten++ curNumberWritten++ @@ -277,8 +276,7 @@ if (passedEntityNames) { isFirst = true writer = null fileSplitNumber = 1 - while (values.hasNext()) { - value = values.next() + while ((value = values.next()) != null) { //Don't bother writing the file if there's nothing //to put into it if (isFirst) {