Fixes #26286 by applying same change for Java9+ as was done in #25165

This commit is contained in:
Thomas Jaeckle 2019-01-31 16:57:01 +00:00
parent 9d6aa8ae94
commit 7e43bbe050

View file

@ -46,7 +46,7 @@ public final class Unsafe {
public static void copyUSAsciiStrToBytes(String str, byte[] bytes) {
if (isJavaVersion9Plus) {
final byte[] chars = (byte[]) instance.getObject(str, stringValueFieldOffset);
System.arraycopy(chars, 0, bytes, 0, chars.length);
System.arraycopy(chars, 0, bytes, 0, str.length());
} else {
final char[] chars = (char[]) instance.getObject(str, stringValueFieldOffset);
int i = 0;