Mike Haberman wrote:
> 
> Hello,
> 
> Turbine make extensive use of java.util.Properties
> 
> The problem that I am coming across is that if Properties.getProperty(x)
> can't find x it returns null.
> 
> However, a majority of the code base doesn't check for null:
> 
> find . -name '*.java' -print -exec grep -B 2 -A 5 'getProperty' {} ';'
> 
> And in a majority of the cases, the next step after getting the property
> is to do a compare against some string constant.
> 
> We have two solutions:
>    1. go back and check for null everywhere
>    2. subclass off Properties (SafeProperties) that returns
>       the string "undef" if the property isn't defined.
> 
> I am doing some work for the torque stuff (see my post in a few minutes)
> and in order to get things to work, I started to add the null check, but
> I soon realized how much code would needed to be changed.
> 
> I will be happy to do either 1 or 2.  I can send the diffs once I am done
> and someone can commit them for me.
> 
> (I have no vote, but if I did, I'd vote for doing number 2, and we
> can go back and apply a sed script to replace Properties with (SafeProperties)
> and be done.)
> 
> thanks again everyone!

Mike, most references to properties file values are or should be wrapped
in a method that allows a default to be supplied.
-- 

Daniel Rall <[EMAIL PROTECTED]>


------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to