On Tue, Aug 23, 2022 at 10:43 PM Mark Thomas <ma...@apache.org> wrote:
>
> Hi all,
>
> I've been looking at a fix for bug 66196. My ideas so far have revolved
> around MessageBytes but the solutions are being made more complex by the
> current behaviour of MessageBytes in some cases.
>
> For example (I'm using strings in place of byte[] and char[] to keep it
> simple):
>
> mb.setBytes("aaa");
> mb.setChars("bbb");
> mb.toBytes();
>
> mb.getByteChunk() returns "aaa" whereas I'd expect it to be "bbb".
>
> I'd like to refactor MessageBytes so it always behaves as if it has a
> single current value regardless of whether that value was set as a
> String, byte[] or char[]. If a get() method is called for a different
> type, conversion occurs on demand.
>
> I'm reasonably confident that changing MessageBytes to always have a
> single, consistent value will also enable a few useful optimizations -
> particularly around ISO-8859-1 String to byte conversions which gets
> used a lot for HTTP response headers.
>
> Note: As currently, if you write to the ByteChunk or CharChunk directly
> the caller is expected to take responsibility for keeping the values in
> sync or dealing with the consequences.
>
> Thoughts?

Well, this is a bit risky obviously but you can attempt it.

Rémy

> Mark
>
>
> [1] https://bz.apache.org/bugzilla/show_bug.cgi?id=66196
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>

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

Reply via email to