]>
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
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
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
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
: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
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
[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