Le 9/17/12 8:47 PM, Niklas Gustavsson a écrit :
On Mon, Sep 17, 2012 at 4:03 PM, Emmanuel Lécharny <[email protected]> wrote:
Thinking about it more, I wonder if the fact that we receive bad chars, but
still produce a String, is not a better solution ?
All in all, you'll be able to see that the file does not exist and return a
correct error, instead of handling an exception.
Well, that will for example not working for putting files. Also, there
is a proper FTP error reply for invalid requests, and I think that's
the proper thing to return for broken requests, which is what
FtpServer correctly does.
The point is that you are expecting the TextLineDecoder to detect a bad
file name, instead of checking the file name in the IoHandler. But
anyway, I think t's not relevant here.
The correct question is : should the TextLine decoder throw an exception
if there is a wrong byte in the incoming bytes, or should it swallow the
wrong byte, and let the String constructor replace this wrong byte by a
'?' char...
Would we say : we should throw an exception, then the patch works, and
that solve your issue as a side effect .
Should we do that ?
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com