> On Mar 22, 2019, at 3:31 PM, Martin Buchholz <[email protected]> wrote:
>
> No need to check for short strings in tooLongMsg.
Yeah that was stupid on my part.
> Getting the actual length calculation 100% is not very important, but THIS IS
> JAVA so here's an attempt that looks correct even for maximal length input
> (untested - you could check that the exception detail gets the 3x expansion
> right):
>
> private static String tooLongMsg(String s, int bits32) {
> int slen = s.length();
> String head = s.substring(0, 8);
> String tail = s.substring(slen - 8, slen);
> // handle int overflow with max 3x expansion
> long actualLength = (long)slen + Integer.toUnsignedLong(bits32 -
> slen);
> return "encoded string (" + head + "..." + tail + ") too long: "
> + actualLength + " bytes";
> }
Ran the test without suppressing the exceptions and the messages look fine.
> Otherwise looks good to me.
Patch updated for the sake of formality. Don’t want to check it into the CI
system until Monday.
Thanks ...