You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2010/01/15 09:14:40 UTC

svn commit: r899557 - /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java

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



Re: svn commit: r899557 - /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java

Posted by Adrian Crum <ad...@hlmksw.com>.
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.


Re: svn commit: r899557 - /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java

Posted by Adam Heath <do...@brainfood.com>.
>>> ==============================================================================
>>>
>>> ---
>>> 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.



Re: svn commit: r899557 - /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java

Posted by Jacopo Cappellato <ja...@hotwaxmedia.com>.
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:
>> jacopoc@apache.org 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.
> 


Re: svn commit: r899557 - /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java

Posted by Adrian Crum <ad...@hlmksw.com>.
Adam Heath wrote:
> jacopoc@apache.org 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.


Re: svn commit: r899557 - /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java

Posted by Adam Heath <do...@brainfood.com>.
jacopoc@apache.org 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.