and also the change in OrderReadHelper.java makes a NPE possible (because EntityUtil.filterByAnd could return a null value)...
Viele Grüße Best Regards From: Adrian Crum <adrian.c...@sandglass-software.com> To: dev@ofbiz.apache.org Date: 12.09.2011 12:21 Subject: Re: svn commit: r1169655 - in /ofbiz/trunk/applications: marketing/src/org/ofbiz/sfa/vcard/ order/src/org/ofbiz/order/order/ order/src/org/ofbiz/order/shoppingcart/ party/src/org/ofbiz/party/communication/ product/src/org/ofbiz/product/category/ This revision will not compile. -Adrian On 9/12/2011 10:09 AM, jler...@apache.org wrote: > Author: jleroux > Date: Mon Sep 12 09:08:59 2011 > New Revision: 1169655 > > URL: http://svn.apache.org/viewvc?rev=1169655&view=rev > Log: > Revert some useless UtilValidate.isNotEmpty() changes in applications (noticed by Scott) > > Modified: > ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java > ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java > ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java > ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java > ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java > > Modified: ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java?rev=1169655&r1=1169654&r2=1169655&view=diff > ============================================================================== > --- ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java (original) > +++ ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java Mon Sep 12 09:08:59 2011 > @@ -122,7 +122,7 @@ public class VCard { > EntityCondition.makeCondition("geoTypeId", EntityOperator.EQUALS, "COUNTRY"), > EntityCondition.makeCondition("geoName", EntityOperator.LIKE, workAddress.getCountry())), EntityOperator.AND); > countryGeoList = delegator.findList("Geo", cond, null, null, null, true); > - if (UtilValidate.isNotEmpty(countryGeoList)) { > + if (!countryGeoList.isEmpty()) { > GenericValue countryGeo = EntityUtil.getFirst(countryGeoList); > serviceCtx.put("countryGeoId", countryGeo.get("geoId")); > } > > Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=1169655&r1=1169654&r2=1169655&view=diff > ============================================================================== > --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original) > +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Mon Sep 12 09:08:59 2011 > @@ -2537,12 +2537,10 @@ public class OrderReadHelper { > > List<GenericValue> promoAdjustments = EntityUtil.filterByAnd(allOrderAdjustments, UtilMisc.toMap("orderAdjustmentTypeId", "PROMOTION_ADJUSTMENT")); > > - if (UtilValidate.isNotEmpty(promoAdjustments)) { > - > + if (!promoAdjustments.isEmpty()) { > Iterator<GenericValue> promoAdjIter = promoAdjustments.iterator(); > while (promoAdjIter.hasNext()) { > GenericValue promoAdjustment = promoAdjIter.next(); > - > if (promoAdjustment != null) { > BigDecimal amount = promoAdjustment.getBigDecimal("amount").setScale(taxCalcScale, taxRounding); > promoAdjTotal = promoAdjTotal.add(amount); > > Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java?rev=1169655&r1=1169654&r2=1169655&view=diff > ============================================================================== > --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java (original) > +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java Mon Sep 12 09:08:59 2011 > @@ -633,7 +633,7 @@ public class ShoppingCartServices { > > List<GenericValue> adjustments = orh.getOrderHeaderAdjustments(); > // If applyQuoteAdjustments is set to false then standard cart adjustments are used. > - if (UtilValidate.isNotEmpty(adjustments)) { > + if (!adjustments.isEmpty()) { > // The cart adjustments are added to the cart > cart.getAdjustments().addAll(adjustments); > } > @@ -726,7 +726,7 @@ public class ShoppingCartServices { > if (UtilValidate.isNotEmpty(quoteTerms)) { > // create order term from quote term > for(GenericValue quoteTerm : quoteTerms) { > - BigDecimal termValue = BigDecimal.ZERO; > + BigDecimal termValue = BigDecimal.ZERO; > if (UtilValidate.isNotEmpty(quoteTerm.getString("termValue"))){ > termValue = new BigDecimal(quoteTerm.getString("termValue")); > } > > Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java?rev=1169655&r1=1169654&r2=1169655&view=diff > ============================================================================== > --- ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java (original) > +++ ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java Mon Sep 12 09:08:59 2011 > @@ -744,7 +744,7 @@ public class CommunicationEventServices > Debug.logError(e, module); > return ServiceUtil.returnError(e.getMessage()); > } > - if (UtilValidate.isNotEmpty(commEvents)) { > + if (!commEvents.isEmpty()) {{ > Debug.logInfo("Ignoring Duplicate Email: " + aboutThisEmail, module); > return ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, > "PartyCommEventMessageIgnoredDuplicateMessageId", locale)); > @@ -756,7 +756,7 @@ public class CommunicationEventServices > List<Map<String, Object>> bccParties = buildListOfPartyInfoFromEmailAddresses(addressesBCC, userLogin, dispatcher); > > //Get the first address from the list - this is the partyIdTo field of the CommunicationEvent > - if (UtilValidate.isNotEmpty(toParties)) { > + if (!toParties.isEmpty()) { > Iterator<Map<String, Object>> itr = toParties.iterator(); > Map<String, Object> firstAddressTo = itr.next(); > partyIdTo = (String)firstAddressTo.get("partyId"); > > Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java?rev=1169655&r1=1169654&r2=1169655&view=diff > ============================================================================== > --- ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java (original) > +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java Mon Sep 12 09:08:59 2011 > @@ -123,7 +123,7 @@ public class CategoryServices { > EntityCondition condition = EntityCondition.makeCondition(EntityCondition.makeCondition("releaseDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("releaseDate", EntityOperator.LESS_THAN_EQUAL_TO, releaseDateLimit)); > filterConditions.add(condition); > } > - if (UtilValidate.isNotEmpty(filterConditions)) { > + if (!filterConditions.isEmpty()) { > productCategoryMembers = EntityUtil.filterByCondition(productCategoryMembers, EntityCondition.makeCondition(filterConditions, EntityOperator.AND)); > } > > @@ -290,7 +290,7 @@ public class CategoryServices { > EntityCondition condition = EntityCondition.makeCondition(EntityCondition.makeCondition("releaseDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("releaseDate", EntityOperator.LESS_THAN_EQUAL_TO, releaseDateLimit)); > filterConditions.add(condition); > } > - if (UtilValidate.isNotEmpty(filterConditions)) { > + if (!filterConditions.isEmpty()) { > productCategoryMembers = EntityUtil.filterByCondition(productCategoryMembers, EntityCondition.makeCondition(filterConditions, EntityOperator.AND)); > } > > @@ -440,7 +440,7 @@ public class CategoryServices { > childOfCats = EntityUtil.filterByDate(delegator.findByAnd("ProdCatalogCategory", UtilMisc.toMap("prodCatalogId", productCategoryId))); > } > if (UtilValidate.isNotEmpty(childOfCats)) { > - > + > for (GenericValue childOfCat : childOfCats ) { > > Object catId = null; > > Dimitri Unruh Consultant AEW Lynx-Consulting GmbH Johanniskirchplatz 6 33615 Bielefeld Deutschland Fon: +49 521 5247-0 Fax: +49 521 5247-250 Mobil: +49 160 90 57 55 13 Wir laden Sie herzlich ein: DSAG-Jahreskongress Datum: 11. - 13. Oktover 2011, Congress Center Leipzig, Halle 2 Stand B01 Besuchen Sie uns an unserem Stand und freuen Sie sich auf einen intensiven Informations- und Erfahrungsaustausch rund um das Thema Mobility! Company and Management Headquarters: Lynx-Consulting GmbH, Johanniskirchplatz 6, 33615 Bielefeld, Deutschland Fon: +49 521 5247-0, Fax: +49 521 5247-250, www.lynx.de Court Registration: Amtsgericht Bielefeld HRB 35946 Chief Executive Officers: Karsten Noss, Dirk Osterkamp http://www.lynx.de/haftungsausschluss