You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2008/03/31 22:31:46 UTC

svn commit: r643134 - /ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.bsh

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);



Re: svn commit: r643134 - /ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.bsh

Posted by Jacques Le Roux <ja...@les7arts.com>.
Yes, I will do it if no one beat me on it... (kind of help wanted ;o)

Jacques

From: "David E Jones" <jo...@undersunconsulting.com>
>
> 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, jleroux@apache.org 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 + "&amp;" +  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);
>>
>>
> 


Re: svn commit: r643134 - /ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.bsh

Posted by David E Jones <jo...@undersunconsulting.com>.
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, jleroux@apache.org 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 + "&amp;" +  
> 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);
>
>


Re: svn commit: r643134 - /ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.bsh

Posted by David E Jones <jo...@undersunconsulting.com>.
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, jleroux@apache.org 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 + "&amp;" +  
> 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);
>
>