|
On 11/11/2010 07:08 AM, [hidden email] 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? > > 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(); > > |
|
On 1/12/2010, at 11:27 AM, Adam Heath wrote:
> On 11/11/2010 07:08 AM, [hidden email] 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? >> >> 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(); >> >> > |
|
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, [hidden email] 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. > >>> >>> 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(); >>> >>> >> > |
|
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, [hidden email] 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. >> >>>> >>>> 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(); >>>> >>>> >>> >> > |
| Free forum by Nabble | Edit this page |
