Why use String.valueOf(msg) in StringEncoder?
Andreas Köhler
andi5.py at gmx.net
Thu Aug 6 19:34:18 EDT 2009
Hi Nicolas,
I suppose that if msg really was null encode() would have returned msg
(null instanceof String) anyway. String.valueOf(msg) does not protect
against msg.toString() returning null on the other hand.
Ciao,
-- andi5
Nicolas Désy wrote:
> It is to prevent a NullPointerException when calling getBytes() on the
> String instance.
>
> -Nicolas
>
>
>> From: mmcgrady at topiatechnology.com
>> To: netty-users at lists.jboss.org
>> Subject: Why use String.valueOf(msg) in StringEncoder?
>> Date: Thu, 6 Aug 2009 10:58:40 -0700
>>
>> If there a reason why encoding uses String.valueOf(msg) in
>> StringEncoder instead of just msg? I cannot see the value of,
>> valueOf, pun intended.
>>
>> Mike
>>
>> Mike McGrady
>> Principal Investigator AF081-028 AFRL SBIR
>> Senior Engineer
>> Topia Technology, Inc.
>> 1.253.720.3365
>> mmcgrady at topiatechnology.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20090807/2498c513/attachment.bin
More information about the netty-users
mailing list