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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Adam Heath-2
[hidden email] 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.

Reply | Threaded
Open this post in threaded view
|

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

Adrian Crum
Adam Heath wrote:

> [hidden email] 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

Reply | Threaded
Open this post in threaded view
|

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

Adam Heath-2
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.