I was actually hoping that would be the response, because I am +1 on
getting out the release as soon as possible. I'll add to TODO and be
ready when the release is out :)


Steven Caswell
[EMAIL PROTECTED]
a.k.a Mungo Knotwise of Michel Delving
"One ring to rule them all, one ring to find them..."


> -----Original Message-----
> From: Henri Yandell [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, September 27, 2002 1:41 PM
> To: Jakarta Commons Developers List
> Subject: Re: [lang] proposal to add a couple of methods to StringUtils
> 
> 
> 
> I'd like to hold it off til after the release.
> 
> Just add to the TODO and let it lie. Else we'll be doing this 
> all over the place :)
> 
> Mainly I just want to get the null/NPE/IAE thing agreed upon 
> and then the main release pushed out.
> 
> While we're an API project, so not quite like many other 
> projects, there is a lot to be said for 
> release-early/release-often, and we've been pretty bad on that.
> 
> Hen
> 
> On Fri, 27 Sep 2002, Steven Caswell wrote:
> 
> > I'd like to add the following methods to StringUtils:
> >
> > String defaultString(Object obj) - behaves the same as 
> > defaultString(String), invoking toString() on the obj to return the 
> > string, or blank if obj is null String defaultString(Object obj, 
> > String defaultString) - same as defaultString(String, String), 
> > invoking toString() on the obj to return the string, or the 
> > defaultString value if obj is null
> >
> > A specific use case: I do lots of debug logging, many times logging 
> > results from various method calls, some of which may not be 
> null-safe. 
> > In cases where a method return could be null, I need to check the 
> > return for null and replace what would be logged with some 
> placeholder 
> > string (i.e., "(null)". So the following code would be replace:
> >
> > debugLog.debug( "MyClass.myMethod() = " + ((MyClass.myMethod() == 
> > null) ? "(null)" : MyClass.myMethod().toString() + ")" );
> >
> > with
> >
> > debugLog.info( "MyClass.myMethod() = " + 
> > StringUtils.defaultString(MyClass.myMethod(), "(null"));
> >
> > I could use StringUtils.defaultString now if the result 
> were a string, 
> > but for non-String objects where is no equivalent. I don't 
> want to use 
> > StringUtils.defaultString(MyClass.myMethod().toString(), "(null)") 
> > because I'll get an NPE on the .toString() and defaultString will 
> > never have a chance.
> >
> > Would this hold up the imminent release? If so I'll defer to 
> > afterward.
> >
> > Steven Caswell
> > [EMAIL PROTECTED]
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:   
> <mailto:commons-dev-> [EMAIL PROTECTED]>
> > For 
> additional commands, 
> e-mail: 
> > <mailto:[EMAIL PROTECTED]>
> >
> >
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:commons-dev-> [EMAIL PROTECTED]>
> For 
> additional commands, 
> e-mail: <mailto:[EMAIL PROTECTED]>
> 
> 



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

Reply via email to