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 2014/03/13 19:23:47 UTC

svn commit: r1577268 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java

Author: jleroux
Date: Thu Mar 13 18:23:47 2014
New Revision: 1577268

URL: http://svn.apache.org/r1577268
Log:
A patch from simon maskell for "Paginate in screen fails" https://issues.apache.org/jira/browse/OFBIZ-5574

When you use the paginate = true in a screen and the total number of rows returned is greater than 999 the string is formatted with a coma and an exception is thrown when trying to convert it to an Integer.

jleroux: this depends on language (French would be space) but Simon's fix works for all (we are only dealing with integers there)

Modified:
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=1577268&r1=1577267&r2=1577268&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java Thu Mar 13 18:23:47 2014
@@ -2688,6 +2688,7 @@ public class ModelForm extends ModelWidg
         String size = this.overrideListSize.expandString(context);
         if (UtilValidate.isNotEmpty(size)) {
             try {
+            	size =size.replaceAll("[^0-9.]", "");
                 listSize = Integer.parseInt(size);
             } catch (NumberFormatException e) {
                 Debug.logError(e, "Error getting override list size from value " + size, module);



Re: svn commit: r1577268 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java

Posted by Jacques Le Roux <ja...@les7arts.com>.
I don't mind the regex compil perf issue in model (that's UI). Of course improving would be welcome.

Jacques

Le 14/03/2014 15:01, Adrian Crum a écrit :
> This commit hides the real problem. We need the String expansion to not localize the number.
>
> Worse, the regex pattern is compiled every time this code fragment is executed.
>
> Adrian Crum
> Sandglass Software
> www.sandglass-software.com
>
> On 3/13/2014 11:23 AM, jleroux@apache.org wrote:
>> Author: jleroux
>> Date: Thu Mar 13 18:23:47 2014
>> New Revision: 1577268
>>
>> URL: http://svn.apache.org/r1577268
>> Log:
>> A patch from simon maskell for "Paginate in screen fails" https://issues.apache.org/jira/browse/OFBIZ-5574
>>
>> When you use the paginate = true in a screen and the total number of rows returned is greater than 999 the string is formatted with a coma and an 
>> exception is thrown when trying to convert it to an Integer.
>>
>> jleroux: this depends on language (French would be space) but Simon's fix works for all (we are only dealing with integers there)
>>
>> Modified:
>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
>>
>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=1577268&r1=1577267&r2=1577268&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java (original)
>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java Thu Mar 13 18:23:47 2014
>> @@ -2688,6 +2688,7 @@ public class ModelForm extends ModelWidg
>>           String size = this.overrideListSize.expandString(context);
>>           if (UtilValidate.isNotEmpty(size)) {
>>               try {
>> +                size =size.replaceAll("[^0-9.]", "");
>>                   listSize = Integer.parseInt(size);
>>               } catch (NumberFormatException e) {
>>                   Debug.logError(e, "Error getting override list size from value " + size, module);
>>
>>
>

Re: svn commit: r1577268 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java

Posted by Adrian Crum <ad...@sandglass-software.com>.
This commit hides the real problem. We need the String expansion to not 
localize the number.

Worse, the regex pattern is compiled every time this code fragment is 
executed.

Adrian Crum
Sandglass Software
www.sandglass-software.com

On 3/13/2014 11:23 AM, jleroux@apache.org wrote:
> Author: jleroux
> Date: Thu Mar 13 18:23:47 2014
> New Revision: 1577268
>
> URL: http://svn.apache.org/r1577268
> Log:
> A patch from simon maskell for "Paginate in screen fails" https://issues.apache.org/jira/browse/OFBIZ-5574
>
> When you use the paginate = true in a screen and the total number of rows returned is greater than 999 the string is formatted with a coma and an exception is thrown when trying to convert it to an Integer.
>
> jleroux: this depends on language (French would be space) but Simon's fix works for all (we are only dealing with integers there)
>
> Modified:
>      ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
>
> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=1577268&r1=1577267&r2=1577268&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java (original)
> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java Thu Mar 13 18:23:47 2014
> @@ -2688,6 +2688,7 @@ public class ModelForm extends ModelWidg
>           String size = this.overrideListSize.expandString(context);
>           if (UtilValidate.isNotEmpty(size)) {
>               try {
> +            	size =size.replaceAll("[^0-9.]", "");
>                   listSize = Integer.parseInt(size);
>               } catch (NumberFormatException e) {
>                   Debug.logError(e, "Error getting override list size from value " + size, module);
>
>