One other thing,

I think that it would be very counter-intuitive to have a non-null String
(or anything else for that matter) suddenly become null.

String result = someMethod();
if( result != null  )
{
      result = result.trim();
      if( result.length() > 10 )                           //
NullPointerException!!!!


Dave Derry





                                                                                       
                                               
                      Dave                                                             
                                               
                      Derry/Technology/Equi         To:      "Jakarta Commons 
Developers List" <[EMAIL PROTECTED]>       
                      fax@Equifax                   cc:                                
                                               
                                                    Subject: Re: [PATCH][LANG] 
StringUtils.trimNull(String)                           
                      01/22/2003 03:10 PM                                              
                                               
                      Please respond to                                                
                                               
                      "Jakarta Commons                                                 
                                               
                      Developers List"                                                 
                                               
                                                                                       
                                               
                                                                                       
                                               




Hi,

I'm just a lurker here, but my preference would be to return an empty
string rather than null when the string consists of just whitespace. I find
it to be annoying to always have to check for null. In fact, I very rarely
initialize a String to null, but generally initialize to "".

Just my 2 cents,
Dave Derry










--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to