|
[hidden email] wrote:
> Author: jacopoc > Date: Fri Jan 15 08:14:39 2010 > New Revision: 899557 > > URL: http://svn.apache.org/viewvc?rev=899557&view=rev > Log: > Based on suggestion by Adam Heath, the warning message is logged only if the count is negative; if the count is zero the next for loop will be skipped and the method will return true as well, but without warning message. > > Modified: > ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java > > Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java?rev=899557&r1=899556&r2=899557&view=diff > ============================================================================== > --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java (original) > +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java Fri Jan 15 08:14:39 2010 > @@ -72,8 +72,8 @@ > return false; > } > > - if (count < 1) { > - Debug.logWarning("Count is less than one, not doing anything: " + rawString(), module); > + if (count < 0) { > + Debug.logWarning("Count is less than zero, not doing anything: " + rawString(), module); > return true; > } Technically, this is a poor wording; negative counts are more an error, and probably shouldn't be happening. |
|
Adam Heath wrote:
> [hidden email] wrote: >> Author: jacopoc >> Date: Fri Jan 15 08:14:39 2010 >> New Revision: 899557 >> >> URL: http://svn.apache.org/viewvc?rev=899557&view=rev >> Log: >> Based on suggestion by Adam Heath, the warning message is logged only if the count is negative; if the count is zero the next for loop will be skipped and the method will return true as well, but without warning message. >> >> Modified: >> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java >> >> Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java?rev=899557&r1=899556&r2=899557&view=diff >> ============================================================================== >> --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java (original) >> +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java Fri Jan 15 08:14:39 2010 >> @@ -72,8 +72,8 @@ >> return false; >> } >> >> - if (count < 1) { >> - Debug.logWarning("Count is less than one, not doing anything: " + rawString(), module); >> + if (count < 0) { >> + Debug.logWarning("Count is less than zero, not doing anything: " + rawString(), module); >> return true; >> } > > Technically, this is a poor wording; negative counts are more an > error, and probably shouldn't be happening. I like the idea of making things blow up if there is a programming error. It forces the programmer to fix it. |
|
Yeah,
I agree with both of you. In rev. 899689 I have fixed this. I have tried to improve the warning message but if you can find a better one (or if you think it should be logged at error level) feel free to change it. Thank you for the feedback, Jacopo On Jan 15, 2010, at 5:15 PM, Adrian Crum wrote: > Adam Heath wrote: >> [hidden email] wrote: >>> Author: jacopoc >>> Date: Fri Jan 15 08:14:39 2010 >>> New Revision: 899557 >>> >>> URL: http://svn.apache.org/viewvc?rev=899557&view=rev >>> Log: >>> Based on suggestion by Adam Heath, the warning message is logged only if the count is negative; if the count is zero the next for loop will be skipped and the method will return true as well, but without warning message. >>> >>> Modified: >>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java >>> >>> Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java >>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java?rev=899557&r1=899556&r2=899557&view=diff >>> ============================================================================== >>> --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java (original) >>> +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java Fri Jan 15 08:14:39 2010 >>> @@ -72,8 +72,8 @@ >>> return false; >>> } >>> - if (count < 1) { >>> - Debug.logWarning("Count is less than one, not doing anything: " + rawString(), module); >>> + if (count < 0) { >>> + Debug.logWarning("Count is less than zero, not doing anything: " + rawString(), module); >>> return true; >>> } >> Technically, this is a poor wording; negative counts are more an >> error, and probably shouldn't be happening. > > I like the idea of making things blow up if there is a programming error. It forces the programmer to fix it. > |
|
In reply to this post by Adrian Crum
>>> ==============================================================================
>>> >>> --- >>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java >>> (original) >>> +++ >>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java >>> Fri Jan 15 08:14:39 2010 >>> @@ -72,8 +72,8 @@ >>> return false; >>> } >>> >>> - if (count < 1) { >>> - Debug.logWarning("Count is less than one, not doing >>> anything: " + rawString(), module); >>> + if (count < 0) { >>> + Debug.logWarning("Count is less than zero, not doing >>> anything: " + rawString(), module); >>> return true; >>> } >> >> Technically, this is a poor wording; negative counts are more an >> error, and probably shouldn't be happening. > > I like the idea of making things blow up if there is a programming > error. It forces the programmer to fix it. Cool then. I'll get right on integrating a dynamite library. |
|
Adam Heath wrote:
>>>> ============================================================================== >>>> >>>> --- >>>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java >>>> (original) >>>> +++ >>>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java >>>> Fri Jan 15 08:14:39 2010 >>>> @@ -72,8 +72,8 @@ >>>> return false; >>>> } >>>> >>>> - if (count < 1) { >>>> - Debug.logWarning("Count is less than one, not doing >>>> anything: " + rawString(), module); >>>> + if (count < 0) { >>>> + Debug.logWarning("Count is less than zero, not doing >>>> anything: " + rawString(), module); >>>> return true; >>>> } >>> Technically, this is a poor wording; negative counts are more an >>> error, and probably shouldn't be happening. >> I like the idea of making things blow up if there is a programming >> error. It forces the programmer to fix it. > > Cool then. I'll get right on integrating a dynamite library. Go right ahead. Have a blast. |
| Free forum by Nabble | Edit this page |
