8219196: DataOutputStream.writeUTF may throw unexpected exceptions
brian.burkhalter at oracle.com
Mon Mar 18 17:41:27 UTC 2019
> On Mar 18, 2019, at 6:40 AM, Roger Riggs <Roger.Riggs at oracle.com> wrote:
> On 03/15/2019 05:06 PM, Brian Burkhalter wrote:
>> Updated: http://cr.openjdk.java.net/~bpb/8219196/webrev.01/ <http://cr.openjdk.java.net/%7Ebpb/8219196/webrev.01/>
> I'm at odds with Martin on including utflen in the loop. (Or that's not what he meant).
> Now it has to do two comparisons for every input byte instead of 1.
That was my original thinking.
> There is no need to have an early exit for input strings that are too long.
> It is a very unusual case, probably never except in testing.
> There might be a case for checking that strlen <= 65535,
> (even at 1 input byte per output byte it would be too large).
> But even that is probably not worth the compare and branch.
This is not clear to me. Are you saying that the proposed fix is not worth doing at all? If that’s not the case then perhaps it should revert to the first version  with the test modified to remove “enabled = false”.
More information about the core-libs-dev