Scott Gray wrote:
> On 10/03/2010, at 3:05 AM, ash...@apache.org wrote:
> 
>> Author: ashish
>> Date: Wed Mar 10 10:05:01 2010
>> New Revision: 921274
>>
>> URL: http://svn.apache.org/viewvc?rev=921274&view=rev
>> Log:
>> Applied patch from jira issue OFBIZ-3547 - Improvement in "equals" method of 
>> "ShoppingCartItem" class.
>> Thanks Awdesh for the contribution.
>>
>> Modified:
>>    
>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
>>
>> Modified: 
>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=921274&r1=921273&r2=921274&view=diff
>> ==============================================================================
>> --- 
>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
>>  (original)
>> +++ 
>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
>>  Wed Mar 10 10:05:01 2010
>> @@ -2332,7 +2332,7 @@ public class ShoppingCartItem implements
>>             return false;
>>         }
>>
>> -        if ((this.attributes != null && attributes != null) &&
>> +        if ((UtilValidate.isNotEmpty(this.attributes) && 
>> UtilValidate.isNotEmpty(attributes)) &&
>>                 ((this.attributes.size() != attributes.size()) ||
>>                 !(this.attributes.equals(attributes)))) {
>>             return false;
>>
> 
> Hi Ashish,
> 
> I'm not entirely clear on what improvement this resulted in, could you or 
> Awdesh please clarify?

Additionally, ShoppingCartItem.attributes can never be null.

this.attributes = item.getAttributes() == null ? new HashMap() : new
HashMap(item.getAttributes());

or

this.attributes = (attributes == null? FastMap.newInstance(): attributes);

This is from the 2 main constructors.

Reply via email to