mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8266320: (bf) ReadOnlyBufferException in heap buffer put(String,int,int) should not be conditional
Reviewed-by: alanb, bpb
This commit is contained in:
parent
ff65920cd1
commit
45760d4baf
1 changed files with 5 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2021, 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
|
||||
|
@ -272,11 +272,10 @@ class Heap$Type$Buffer$RW$
|
|||
#if[char]
|
||||
|
||||
public $Type$Buffer put(String src, int start, int end) {
|
||||
#if[rw]
|
||||
checkScope();
|
||||
int length = end - start;
|
||||
Objects.checkFromIndexSize(start, length, src.length());
|
||||
if (isReadOnly())
|
||||
throw new ReadOnlyBufferException();
|
||||
int pos = position();
|
||||
int lim = limit();
|
||||
int rem = (pos <= lim) ? lim - pos : 0;
|
||||
|
@ -285,6 +284,9 @@ class Heap$Type$Buffer$RW$
|
|||
src.getChars(start, end, hb, ix(pos));
|
||||
position(pos + length);
|
||||
return this;
|
||||
#else[rw]
|
||||
throw new ReadOnlyBufferException();
|
||||
#end[rw]
|
||||
}
|
||||
|
||||
#end[char]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue