Jacques, Could you be more specific about what you are trying to fix here? What was the problem you ran into, and how does this fix it? I don't know that this is the case, but it appears that you did not try to understand the code before changing it. The point of the was originally to not change a field when no parameter was passed in for it, which is what it means when the parameter is null. Only when the parameter IS passed in and the parameter is a zero length (empty) string should the corresponding field in the database be cleared. -David On Jun 27, 2008, at 2:32 AM, [hidden email] wrote: > Author: jleroux > Date: Fri Jun 27 01:32:16 2008 > New Revision: 672187 > > URL: http://svn.apache.org/viewvc?rev=672187&view=rev > Log: > Fix a bug when emptying a field (blanking it) > > Modified: > ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/ > GenericWebEvent.java > > Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/ > GenericWebEvent.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/GenericWebEvent.java?rev=672187&r1=672186&r2=672187&view=diff > = > = > = > = > = > = > = > = > ====================================================================== > --- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/ > GenericWebEvent.java (original) > +++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/ > GenericWebEvent.java Fri Jun 27 01:32:16 2008 > @@ -180,7 +180,11 @@ > } > > String fval = request.getParameter(field.getName()); > - if (fval != null && fval.length() > 0) { > + if (fval != null && fval.length() <= 0) { > + fval = null; > + } > + if (fval == null || fval.length() > 0) { > + > try { > findByEntity.setString(field.getName(), fval); > } catch (Exception e) { > > |
Administrator
|
Hi David,
The idea behind this fix is to be able to "unexpire" a value. If you expire a value by setting a past date to thruDate and latter want to "unexpire" it by blanking the thruDate field it was not working. Maybe blanking is not the right way to do it ? You are right that I'm not the original writer of this fix, but it was tested seriously. Jacques From: "David E Jones" <[hidden email]> > > Jacques, > > Could you be more specific about what you are trying to fix here? What was the problem you ran into, and how does this fix it? > > I don't know that this is the case, but it appears that you did not try to understand the code before changing it. The point of > the was originally to not change a field when no parameter was passed in for it, which is what it means when the parameter is > null. > > Only when the parameter IS passed in and the parameter is a zero length (empty) string should the corresponding field in the > database be cleared. > > -David > > > On Jun 27, 2008, at 2:32 AM, [hidden email] wrote: > >> Author: jleroux >> Date: Fri Jun 27 01:32:16 2008 >> New Revision: 672187 >> >> URL: http://svn.apache.org/viewvc?rev=672187&view=rev >> Log: >> Fix a bug when emptying a field (blanking it) >> >> Modified: >> ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/ GenericWebEvent.java >> >> Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/ GenericWebEvent.java >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/GenericWebEvent.java?rev=672187&r1=672186&r2=672187&view=diff >> = = = = = = = = ====================================================================== >> --- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/ GenericWebEvent.java (original) >> +++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/ GenericWebEvent.java Fri Jun 27 01:32:16 2008 >> @@ -180,7 +180,11 @@ >> } >> >> String fval = request.getParameter(field.getName()); >> - if (fval != null && fval.length() > 0) { >> + if (fval != null && fval.length() <= 0) { >> + fval = null; >> + } >> + if (fval == null || fval.length() > 0) { >> + >> try { >> findByEntity.setString(field.getName(), fval); >> } catch (Exception e) { >> >> > |
Jacques, Was this change based on the release4.0 branch? It looks like the issue was fixed in the trunk in SVN rev 539527. That fix plus this fix now cause the code to make no sense... What might be the best way to go is to put the SVN rev 539527 changes in the release4.0 branch, and revert these changes to the trunk and the branch. -David On Jun 27, 2008, at 11:13 PM, Jacques Le Roux wrote: > Hi David, > > The idea behind this fix is to be able to "unexpire" a value. If you > expire a value by setting a past date to thruDate and latter want to > "unexpire" it by blanking the thruDate field it was not working. > Maybe blanking is not the right way to do it ? > > You are right that I'm not the original writer of this fix, but it > was tested seriously. > > Jacques > > From: "David E Jones" <[hidden email]> >> >> Jacques, >> >> Could you be more specific about what you are trying to fix here? >> What was the problem you ran into, and how does this fix it? >> >> I don't know that this is the case, but it appears that you did >> not try to understand the code before changing it. The point of >> the was originally to not change a field when no parameter was >> passed in for it, which is what it means when the parameter is null. >> >> Only when the parameter IS passed in and the parameter is a zero >> length (empty) string should the corresponding field in the >> database be cleared. >> >> -David >> >> >> On Jun 27, 2008, at 2:32 AM, [hidden email] wrote: >> >>> Author: jleroux >>> Date: Fri Jun 27 01:32:16 2008 >>> New Revision: 672187 >>> >>> URL: http://svn.apache.org/viewvc?rev=672187&view=rev >>> Log: >>> Fix a bug when emptying a field (blanking it) >>> >>> Modified: >>> ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/ >>> GenericWebEvent.java >>> >>> Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/ >>> GenericWebEvent.java >>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/GenericWebEvent.java?rev=672187&r1=672186&r2=672187&view=diff >>> = = = = = = = = >>> = >>> = >>> ==================================================================== >>> --- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/ >>> GenericWebEvent.java (original) >>> +++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/ >>> GenericWebEvent.java Fri Jun 27 01:32:16 2008 >>> @@ -180,7 +180,11 @@ >>> } >>> >>> String fval = request.getParameter(field.getName()); >>> - if (fval != null && fval.length() > 0) { >>> + if (fval != null && fval.length() <= 0) { >>> + fval = null; >>> + } >>> + if (fval == null || fval.length() > 0) { >>> + >>> try { >>> findByEntity.setString(field.getName(), fval); >>> } catch (Exception e) { >>> >>> > |
Administrator
|
Sorry David,
I was not aware of this change. And yes, the change came from release4.0. It was harmless but duplicate. I reverted (trunk 672687, rel4 672688) and merged (rel4 672689) following your advice Jacques From: "David E Jones" <[hidden email]> > > Jacques, > > Was this change based on the release4.0 branch? > > It looks like the issue was fixed in the trunk in SVN rev 539527. That fix plus this fix now cause the code to make no sense... > > What might be the best way to go is to put the SVN rev 539527 changes in the release4.0 branch, and revert these changes to the > trunk and the branch. > > -David > > > On Jun 27, 2008, at 11:13 PM, Jacques Le Roux wrote: > >> Hi David, >> >> The idea behind this fix is to be able to "unexpire" a value. If you expire a value by setting a past date to thruDate and >> latter want to "unexpire" it by blanking the thruDate field it was not working. Maybe blanking is not the right way to do it ? >> >> You are right that I'm not the original writer of this fix, but it was tested seriously. >> >> Jacques >> >> From: "David E Jones" <[hidden email]> >>> >>> Jacques, >>> >>> Could you be more specific about what you are trying to fix here? What was the problem you ran into, and how does this fix it? >>> >>> I don't know that this is the case, but it appears that you did not try to understand the code before changing it. The point >>> of the was originally to not change a field when no parameter was passed in for it, which is what it means when the >>> parameter is null. >>> >>> Only when the parameter IS passed in and the parameter is a zero length (empty) string should the corresponding field in the >>> database be cleared. >>> >>> -David >>> >>> >>> On Jun 27, 2008, at 2:32 AM, [hidden email] wrote: >>> >>>> Author: jleroux >>>> Date: Fri Jun 27 01:32:16 2008 >>>> New Revision: 672187 >>>> >>>> URL: http://svn.apache.org/viewvc?rev=672187&view=rev >>>> Log: >>>> Fix a bug when emptying a field (blanking it) >>>> >>>> Modified: >>>> ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/ GenericWebEvent.java >>>> >>>> Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/ GenericWebEvent.java >>>> URL: >>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/GenericWebEvent.java?rev=672187&r1=672186&r2=672187&view=diff >>>> = = = = = = = = = = ==================================================================== >>>> --- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/ GenericWebEvent.java (original) >>>> +++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/ GenericWebEvent.java Fri Jun 27 01:32:16 2008 >>>> @@ -180,7 +180,11 @@ >>>> } >>>> >>>> String fval = request.getParameter(field.getName()); >>>> - if (fval != null && fval.length() > 0) { >>>> + if (fval != null && fval.length() <= 0) { >>>> + fval = null; >>>> + } >>>> + if (fval == null || fval.length() > 0) { >>>> + >>>> try { >>>> findByEntity.setString(field.getName(), fval); >>>> } catch (Exception e) { >>>> >>>> >> > |
Free forum by Nabble | Edit this page |