RFR: 8313809: String template fails with java.lang.StringIndexOutOfBoundsException if last fragment is UTF16
Claes Redestad
redestad at openjdk.org
Tue Aug 8 19:08:36 UTC 2023
On Tue, 8 Aug 2023 18:31:04 GMT, Jim Laskey <jlaskey at openjdk.org> wrote:
> The last fragment of a string template does not get it's coder added to the mix.
LGTM. This also adds an implicit null check on the last fragment.
src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java line 1129:
> 1127: }
> 1128:
> 1129: initialLengthCoder -= lastFragment.length();
Nit: Could leverage the fact that the last fragment will always be at `fragments.get(ttypes.length)` here and simplify above (remove `lastFragment`, move `initialLengthCoder` back to L1122)
test/jdk/java/lang/template/T8313809.java line 27:
> 25: * @test
> 26: * @bug 8313809
> 27: * @summary String template fails with java.lang.StringIndexOutOfBoundsException if the string contains euro symbol.
Perhaps could use the same phrasing as the bug summary?
-------------
Marked as reviewed by redestad (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/15195#pullrequestreview-1567922299
PR Review Comment: https://git.openjdk.org/jdk/pull/15195#discussion_r1287529542
PR Review Comment: https://git.openjdk.org/jdk/pull/15195#discussion_r1287515955
More information about the core-libs-dev
mailing list