On 1/12/2010, at 12:13 PM, Adam Heath wrote:

> On 11/30/2010 05:11 PM, Scott Gray wrote:
>> On 1/12/2010, at 11:27 AM, Adam Heath wrote:
>> 
>>> On 11/11/2010 07:08 AM, [email protected] wrote:
>>>> Author: ashish
>>>> Date: Thu Nov 11 13:08:38 2010
>>>> New Revision: 1033928
>>>> 
>>>> URL: http://svn.apache.org/viewvc?rev=1033928&view=rev
>>>> Log:
>>>> Fixing NPE. Thanks Pranay!
>>> 
>>> In what situations would this NPE occur?
>> 
>> Ooh ooh, I think I know the answer to this one! Is it when strings is null?
> 
> But in what circumstance would strings be null?  Note the lack of context 
> before the patch.

Good point, now that I actually go and look at a longer diff this fix shouldn't 
be necessary at all.  strings is initialized with a FastList instance and isn't 
nulled anywhere that I can see.

>> 
>>>> 
>>>> Modified:
>>>>     
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/product/product/KeywordIndex.java
>>>> 
>>>> Modified: 
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/product/product/KeywordIndex.java
>>>> URL: 
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/KeywordIndex.java?rev=1033928&r1=1033927&r2=1033928&view=diff
>>>> ==============================================================================
>>>> --- 
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/product/product/KeywordIndex.java
>>>>  (original)
>>>> +++ 
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/product/product/KeywordIndex.java
>>>>  Thu Nov 11 13:08:38 2010
>>>> @@ -32,6 +32,7 @@ import org.ofbiz.base.util.GeneralExcept
>>>>  import org.ofbiz.base.util.UtilDateTime;
>>>>  import org.ofbiz.base.util.UtilMisc;
>>>>  import org.ofbiz.base.util.UtilProperties;
>>>> +import org.ofbiz.base.util.UtilValidate;
>>>>  import org.ofbiz.common.KeywordSearchUtil;
>>>>  import org.ofbiz.content.data.DataResourceWorker;
>>>>  import org.ofbiz.entity.Delegator;
>>>> @@ -182,10 +183,11 @@ public class KeywordIndex {
>>>>                  }
>>>>              }
>>>>          }
>>>> -
>>>> -        for (String str: strings) {
>>>> -            // call process keywords method here
>>>> -            KeywordSearchUtil.processKeywordsForIndex(str, keywords, 
>>>> separators, stopWordBagAnd, stopWordBagOr, removeStems, stemSet);
>>>> +        if (UtilValidate.isNotEmpty(strings)) {
>>>> +            for (String str: strings) {
>>>> +                // call process keywords method here
>>>> +                KeywordSearchUtil.processKeywordsForIndex(str, keywords, 
>>>> separators, stopWordBagAnd, stopWordBagOr, removeStems, stemSet);
>>>> +            }
>>>>          }
>>>> 
>>>>          List<GenericValue>   toBeStored = FastList.newInstance();
>>>> 
>>>> 
>>> 
>> 
> 

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to