Re: [LANG] Do we have a safeToString() ?

2003-08-14 Thread Brian S O'Neill
]> Newsgroups: hometree.jakarta.commons.dev To: <[EMAIL PROTECTED]> Sent: Tuesday, August 05, 2003 05:04 A Subject: Re: [LANG] Do we have a safeToString() ? > [EMAIL PROTECTED] writes: > > >StringUtils.defaultString() > > Takes a String, not an Object. > > >ObjectUt

RE: [LANG] Do we have a safeToString() ?

2003-08-14 Thread Gary Gregory
August 05, 2003 07:24 To: Jakarta Commons Developers List; [EMAIL PROTECTED] Subject: Re: [LANG] Do we have a safeToString() ? The safe way to call toString and avoid a NPE is to call String.valueOf(xxx). If the underlying toString method throws some other exception internally, that except

RE: [LANG] Do we have a safeToString() ?

2003-08-14 Thread Arun Thomas
If so, WHY? Why not use String.valueOf(Object obj)? Not particularly more convenient is it? -AMT -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 05, 2003 9:39 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [LANG] Do we have a

Re: [LANG] Do we have a safeToString() ?

2003-08-14 Thread Henning Schmiedehausen
Hi, this is not in the 1.0.1 release, so I wasn't aware of it when I looked at http://jakarta.apache.org/commons/lang/api/ Thanks for pointing out. However, as I need to use a released version (unfortunately there is no newer release yet), I'll stay with String.valueOf() which does the job quite

RE: [LANG] Do we have a safeToString() ?

2003-08-11 Thread scolebourne
:39 AM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: Re: [LANG] Do we have a safeToString() ? > > > Nope. > > ObjectUtils.toString(Object obj) > null -> null, else obj.toString() > > ObjectUtils.toString(Object obj,String nullValue) > null -> n

Re: [LANG] Do we have a safeToString() ?

2003-08-06 Thread scolebourne
Nope. ObjectUtils.toString(Object obj) null -> null, else obj.toString() ObjectUtils.toString(Object obj,String nullValue) null -> nullValue, else obj.toString() Stephen > from:"Henning P. Schmiedehausen" <[EMAIL PROTECTED]> > [EMAIL PROTECTED] writes: > >ObjectUtils.toString() > > Wh

Re: [LANG] Do we have a safeToString() ?

2003-08-05 Thread Henning P. Schmiedehausen
[EMAIL PROTECTED] writes: >StringUtils.defaultString() Takes a String, not an Object. >ObjectUtils.toString() What? This might return [EMAIL PROTECTED] in my memory. I want to call toString() on arbitrary objects and avoid the NPE when I do .toString(). Regards Hennin