mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8263742: (bf) MappedByteBuffer.force() should use the capacity as its upper bound
Reviewed-by: adinn, alanb
This commit is contained in:
parent
c82a673cf6
commit
fa0f1614ff
1 changed files with 8 additions and 8 deletions
|
@ -232,9 +232,9 @@ public abstract class MappedByteBuffer
|
||||||
if (fd == null) {
|
if (fd == null) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
int limit = limit();
|
int capacity = capacity();
|
||||||
if (isSync || ((address != 0) && (limit != 0))) {
|
if (isSync || ((address != 0) && (capacity != 0))) {
|
||||||
return force(0, limit);
|
return force(0, capacity);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -267,11 +267,11 @@ public abstract class MappedByteBuffer
|
||||||
* @param index
|
* @param index
|
||||||
* The index of the first byte in the buffer region that is
|
* The index of the first byte in the buffer region that is
|
||||||
* to be written back to storage; must be non-negative
|
* to be written back to storage; must be non-negative
|
||||||
* and less than limit()
|
* and less than {@code capacity()}
|
||||||
*
|
*
|
||||||
* @param length
|
* @param length
|
||||||
* The length of the region in bytes; must be non-negative
|
* The length of the region in bytes; must be non-negative
|
||||||
* and no larger than limit() - index
|
* and no larger than {@code capacity() - index}
|
||||||
*
|
*
|
||||||
* @throws IndexOutOfBoundsException
|
* @throws IndexOutOfBoundsException
|
||||||
* if the preconditions on the index and length do not
|
* if the preconditions on the index and length do not
|
||||||
|
@ -289,10 +289,10 @@ public abstract class MappedByteBuffer
|
||||||
if (fd == null) {
|
if (fd == null) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
int limit = limit();
|
int capacity = capacity();
|
||||||
if ((address != 0) && (limit != 0)) {
|
if ((address != 0) && (capacity != 0)) {
|
||||||
// check inputs
|
// check inputs
|
||||||
Objects.checkFromIndexSize(index, length, limit);
|
Objects.checkFromIndexSize(index, length, capacity);
|
||||||
SCOPED_MEMORY_ACCESS.force(scope(), fd, address, isSync, index, length);
|
SCOPED_MEMORY_ACCESS.force(scope(), fd, address, isSync, index, length);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue