mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8218227: StringBuilder/StringBuffer constructor throws confusing NegativeArraySizeException
Reviewed-by: rriggs
This commit is contained in:
parent
621bf58687
commit
076d2267b6
5 changed files with 136 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1994, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -148,7 +148,7 @@ import jdk.internal.HotSpotIntrinsicCandidate;
|
|||
*/
|
||||
@HotSpotIntrinsicCandidate
|
||||
public StringBuffer(String str) {
|
||||
super(str.length() + 16);
|
||||
super(str.coder(), str.length(), 16);
|
||||
append(str);
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ import jdk.internal.HotSpotIntrinsicCandidate;
|
|||
* @since 1.5
|
||||
*/
|
||||
public StringBuffer(CharSequence seq) {
|
||||
this(seq.length() + 16);
|
||||
super(String.LATIN1, seq.length(), 16);
|
||||
append(seq);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue