On 28/12/2012 00:04, Konstantin Kolinko wrote:

> Looking at the current code, "new String()" call still remains in WsFrame.java
> Starting with Line 270:
> 
>                 if (controlBufferBinary.remaining() > 0) {
>                     CoderResult cr = utf8DecoderControl.decode(
>                             controlBufferBinary, controlBufferText, true);
>                     if (cr.isError()) {
>                         controlBufferBinary.clear();
>                         controlBufferText.clear();
>                         throw new WsIOException(new CloseReason(
>                                 CloseCodes.PROTOCOL_ERROR,
>                                 sm.getString("wsFrame.invalidUtf8Close")));
>                     }
>                     reason = new String(controlBufferBinary.array(),
>                             controlBufferBinary.arrayOffset() +
>                                     controlBufferBinary.position(),
>                             controlBufferBinary.remaining(), "UTF8");
>                 }
> 
> Why use "new String(.., UTF8)" when there is
> "utf8DecoderControl.decode(..)" call several lines above?
> 
> Isn't it supposed to use controlBufferText here ?

It is. The decoder catches the encoding problems which is why the
Autobahn tests pass but I should have removed the new String() at the
same time.

I've fixed this. Thanks yet again for the review.

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to