Why use String.valueOf(msg) in StringEncoder?

"이희승 (Trustin Lee)" trustin at gmail.com
Thu Aug 6 23:41:38 EDT 2009


You guys are right.  There's no point in using String.valueOf().  My
bad! :-O

On 08/07/2009 08:34 AM, Andreas Köhler wrote:
> 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
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users



More information about the netty-users mailing list