You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Two examples that I've found include WebSocketFrame.toString() and DefaultByteBufHolder.toString(). toString() implementations should always try to avoid throwing exceptions, since they're used for things like creating exception messages and arbitrary logging of inputs/outputs. Consequently, if toString() does throw an exception, this will often hide another real problem, a typical example would be:
In this example, if doSomeProcessing throws an exception, the exception will be caught, but not logged, instead, when frame.toString() is invoked, that will throw an IllegalReferenceCountException.
I don't think there's any need to guard access to ByteBuf.toString(), since it likewise shouldn't throw an exception for the same reasons as above, so ByteBufHoldertoString() implementations should just invoke that directly without going through any reference count checks.
The text was updated successfully, but these errors were encountered:
Motivation:
As toString() is often used while logging we need to ensure this produces no exception.
Modifications:
Ensure we never throw an IllegalReferenceCountException.
Result:
Be able to log without produce exceptions.
Motivation:
As toString() is often used while logging we need to ensure this produces no exception.
Modifications:
Ensure we never throw an IllegalReferenceCountException.
Result:
Be able to log without produce exceptions.
Motivation:
As toString() is often used while logging we need to ensure this produces no exception.
Modifications:
Ensure we never throw an IllegalReferenceCountException.
Result:
Be able to log without produce exceptions.
Motivation:
As toString() is often used while logging we need to ensure this produces no exception.
Modifications:
Ensure we never throw an IllegalReferenceCountException.
Result:
Be able to log without produce exceptions.
…ception
Motivation:
As toString() is often used while logging we need to ensure this produces no exception.
Modifications:
Ensure we never throw an IllegalReferenceCountException.
Result:
Be able to log without produce exceptions.
Two examples that I've found include
WebSocketFrame.toString()
andDefaultByteBufHolder.toString()
.toString()
implementations should always try to avoid throwing exceptions, since they're used for things like creating exception messages and arbitrary logging of inputs/outputs. Consequently, iftoString()
does throw an exception, this will often hide another real problem, a typical example would be:In this example, if
doSomeProcessing
throws an exception, the exception will be caught, but not logged, instead, whenframe.toString()
is invoked, that will throw anIllegalReferenceCountException
.I don't think there's any need to guard access to
ByteBuf.toString()
, since it likewise shouldn't throw an exception for the same reasons as above, soByteBufHolder
toString()
implementations should just invoke that directly without going through any reference count checks.The text was updated successfully, but these errors were encountered: