mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8260927: StringBuilder::insert is incorrect without Compact Strings
Reviewed-by: redestad, alanb, rriggs, jlaskey
This commit is contained in:
parent
ed1a7755c3
commit
081fa3e715
2 changed files with 3 additions and 2 deletions
|
@ -3621,7 +3621,7 @@ public final class String
|
||||||
*/
|
*/
|
||||||
void getBytes(byte[] dst, int srcPos, int dstBegin, byte coder, int length) {
|
void getBytes(byte[] dst, int srcPos, int dstBegin, byte coder, int length) {
|
||||||
if (coder() == coder) {
|
if (coder() == coder) {
|
||||||
System.arraycopy(value, srcPos, dst, dstBegin << coder, length << coder());
|
System.arraycopy(value, srcPos << coder, dst, dstBegin << coder, length << coder);
|
||||||
} else { // this.coder == LATIN && coder == UTF16
|
} else { // this.coder == LATIN && coder == UTF16
|
||||||
StringLatin1.inflate(value, srcPos, dst, dstBegin, length);
|
StringLatin1.inflate(value, srcPos, dst, dstBegin, length);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,9 +27,10 @@ import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @run testng Insert
|
|
||||||
* @bug 4914802 8257511
|
* @bug 4914802 8257511
|
||||||
* @summary Test StringBuilder.insert sanity tests
|
* @summary Test StringBuilder.insert sanity tests
|
||||||
|
* @run testng/othervm -XX:-CompactStrings Insert
|
||||||
|
* @run testng/othervm -XX:+CompactStrings Insert
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public class Insert {
|
public class Insert {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue