Just a quick thought: it might be better to add it to the _ERROR_MESSAGE_LIST_ as there might be more than one error, even with multiple fields with invalid values. -David On Mar 31, 2008, at 2:31 PM, [hidden email] wrote: > Author: jleroux > Date: Mon Mar 31 13:31:43 2008 > New Revision: 643134 > > URL: http://svn.apache.org/viewvc?rev=643134&view=rev > Log: > A patch from Pranay Pandey "Searching entities with non numeric > chars in numeric field generates an error" (https://issues.apache.org/jira/browse/OFBIZ-1729 > ) - OFBIZ-1729 > > Modified: > ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/ > entity/FindGeneric.bsh > > Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/ > actions/entity/FindGeneric.bsh > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.bsh?rev=643134&r1=643133&r2=643134&view=diff > = > = > = > = > = > = > = > = > ====================================================================== > --- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/ > entity/FindGeneric.bsh (original) > +++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/ > entity/FindGeneric.bsh Mon Mar 31 13:31:43 2008 > @@ -73,8 +73,13 @@ > if (fval != null) { > if (fval.length() > 0) { > curFindString = curFindString + "&" + > field.getName() + "=" + fval; > - findByEntity.setString(field.getName(), fval); > - } > + try { > + findByEntity.setString(field.getName(), fval); > + } catch (NumberFormatException nfe) { > + Debug.logError(nfe, "Caught an exception : > "+nfe.toString(), "FindGeneric.bsh"); > + request.setAttribute("_ERROR_MESSAGE_", "Entered > value is non-numeric for numeric field: "+field.getName()); > + } > + } > } > } > curFindString = UtilFormatOut.encodeQuery(curFindString); > > |
Administrator
|
Yes, I will do it if no one beat me on it... (kind of help wanted ;o)
Jacques From: "David E Jones" <[hidden email]> > > Just a quick thought: it might be better to add it to the _ERROR_MESSAGE_LIST_ as there might be more than one error, even with > multiple fields with invalid values. > > -David > > > On Mar 31, 2008, at 2:31 PM, [hidden email] wrote: >> Author: jleroux >> Date: Mon Mar 31 13:31:43 2008 >> New Revision: 643134 >> >> URL: http://svn.apache.org/viewvc?rev=643134&view=rev >> Log: >> A patch from Pranay Pandey "Searching entities with non numeric chars in numeric field generates an error" >> (https://issues.apache.org/jira/browse/OFBIZ-1729 ) - OFBIZ-1729 >> >> Modified: >> ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/ entity/FindGeneric.bsh >> >> Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/ actions/entity/FindGeneric.bsh >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.bsh?rev=643134&r1=643133&r2=643134&view=diff >> = = = = = = = = ====================================================================== >> --- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/ entity/FindGeneric.bsh (original) >> +++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/ entity/FindGeneric.bsh Mon Mar 31 13:31:43 2008 >> @@ -73,8 +73,13 @@ >> if (fval != null) { >> if (fval.length() > 0) { >> curFindString = curFindString + "&" + field.getName() + "=" + fval; >> - findByEntity.setString(field.getName(), fval); >> - } >> + try { >> + findByEntity.setString(field.getName(), fval); >> + } catch (NumberFormatException nfe) { >> + Debug.logError(nfe, "Caught an exception : "+nfe.toString(), "FindGeneric.bsh"); >> + request.setAttribute("_ERROR_MESSAGE_", "Entered value is non-numeric for numeric field: "+field.getName()); >> + } >> + } >> } >> } >> curFindString = UtilFormatOut.encodeQuery(curFindString); >> >> > |
Free forum by Nabble | Edit this page |