You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Adam Heath <do...@brainfood.com> on 2010/01/27 18:54:15 UTC

Re: svn commit: r903571 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java

jleroux@apache.org wrote:
> Author: jleroux
> Date: Wed Jan 27 08:59:25 2010
> New Revision: 903571
> 
> URL: http://svn.apache.org/viewvc?rev=903571&view=rev
> Log:
> After Adam's remark about formatting (actually mostly about Double instead of double), Sascha provided a new patch which was still not well formatted. So I decided to use the same formatting than in getPropertyValue. Even if it does not follow the "brackets around blocks rule" Sun convention. I have explained this a bit to Sascha at https://issues.apache.org/jira/browse/OFBIZ-3425 "Extend getPropertyNumber, Default Value"
> 
> Modified:
>     ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java
> 
> Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java?rev=903571&r1=903570&r2=903571&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java (original)
> +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java Wed Jan 27 08:59:25 2010
> @@ -118,13 +118,13 @@
>              return value;
>      }
>  
> -    public static double getPropertyNumber(String resource, String name, Double defaultValue) {
> +    public static double getPropertyNumber(String resource, String name, double defaultValue) {
>          double value = getPropertyNumber(resource, name);
> -         if(value == 0.00000){
> -             return defaultValue;
> -         }
>  
> -        return value;
> +        if (value == 0.00000)
> +            return defaultValue;
> +        else
> +            return value;
>      }
>  
>      public static double getPropertyNumber(String resource, String name) {

Actually, this is still broken.  What happens if I put 0.00000 into
the property file?  Suddenly, the default will be returned.


Re: svn commit: r903571 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java

Posted by Adam Heath <do...@brainfood.com>.
Adrian Crum wrote:
> Adam Heath wrote:
>> Actually, this is still broken.  What happens if I put 0.00000 into
>> the property file?  Suddenly, the default will be returned.
> 
> It would also be helpful to give these methods more meaningful names,
> like getPropertyAsDouble.

I agree, but have these methods existed in a release branch?  If so,
they need to be deprecated, kept around, and call into the newly named
methods.


Re: svn commit: r903571 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java

Posted by Adrian Crum <ad...@hlmksw.com>.
Adam Heath wrote:
> jleroux@apache.org wrote:
>> Author: jleroux
>> Date: Wed Jan 27 08:59:25 2010
>> New Revision: 903571
>>
>> URL: http://svn.apache.org/viewvc?rev=903571&view=rev
>> Log:
>> After Adam's remark about formatting (actually mostly about Double instead of double), Sascha provided a new patch which was still not well formatted. So I decided to use the same formatting than in getPropertyValue. Even if it does not follow the "brackets around blocks rule" Sun convention. I have explained this a bit to Sascha at https://issues.apache.org/jira/browse/OFBIZ-3425 "Extend getPropertyNumber, Default Value"
>>
>> Modified:
>>     ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java
>>
>> Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java?rev=903571&r1=903570&r2=903571&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java (original)
>> +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java Wed Jan 27 08:59:25 2010
>> @@ -118,13 +118,13 @@
>>              return value;
>>      }
>>  
>> -    public static double getPropertyNumber(String resource, String name, Double defaultValue) {
>> +    public static double getPropertyNumber(String resource, String name, double defaultValue) {
>>          double value = getPropertyNumber(resource, name);
>> -         if(value == 0.00000){
>> -             return defaultValue;
>> -         }
>>  
>> -        return value;
>> +        if (value == 0.00000)
>> +            return defaultValue;
>> +        else
>> +            return value;
>>      }
>>  
>>      public static double getPropertyNumber(String resource, String name) {
> 
> Actually, this is still broken.  What happens if I put 0.00000 into
> the property file?  Suddenly, the default will be returned.

It would also be helpful to give these methods more meaningful names, 
like getPropertyAsDouble.

-Adrian