mirror of
https://github.com/corda/corda.git
synced 2025-01-31 16:35:43 +00:00
Semantics of getChars was incorrect. It should specify a begin
and end index, not a bunch of lengths
This commit is contained in:
parent
e831a41e90
commit
db2b7e8fa7
@ -301,13 +301,13 @@ public final class String implements Comparable<String> {
|
|||||||
return getBytes();
|
return getBytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getChars(int srcOffset, int srcLength,
|
public void getChars(int srcOffset, int srcEnd,
|
||||||
char[] dst, int dstOffset)
|
char[] dst, int dstOffset)
|
||||||
{
|
{
|
||||||
if (srcOffset < 0 || srcOffset + srcLength > length) {
|
if (srcOffset < 0 || srcEnd > length) {
|
||||||
throw new IndexOutOfBoundsException();
|
throw new IndexOutOfBoundsException();
|
||||||
}
|
}
|
||||||
|
int srcLength = srcEnd-srcOffset;
|
||||||
if (data instanceof char[]) {
|
if (data instanceof char[]) {
|
||||||
char[] src = (char[]) data;
|
char[] src = (char[]) data;
|
||||||
System.arraycopy(src, offset + srcOffset, dst, dstOffset, srcLength);
|
System.arraycopy(src, offset + srcOffset, dst, dstOffset, srcLength);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user