mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8295456: (ch) sun.nio.ch.Util::checkBufferPositionAligned gives misleading/incorrect error
Reviewed-by: alanb
This commit is contained in:
parent
e27bea0c4d
commit
a5f6e31ccb
3 changed files with 11 additions and 13 deletions
|
@ -502,19 +502,18 @@ public class Util {
|
|||
return dbb;
|
||||
}
|
||||
|
||||
static void checkBufferPositionAligned(ByteBuffer bb,
|
||||
int pos, int alignment)
|
||||
static void checkBufferPositionAligned(ByteBuffer bb, int pos, int alignment)
|
||||
throws IOException
|
||||
{
|
||||
if (bb.alignmentOffset(pos, alignment) != 0) {
|
||||
throw new IOException("Current location of the bytebuffer ("
|
||||
final int alignmentOffset = bb.alignmentOffset(pos, alignment);
|
||||
if (alignmentOffset != 0) {
|
||||
throw new IOException("Current position of the bytebuffer ("
|
||||
+ pos + ") is not a multiple of the block size ("
|
||||
+ alignment + ")");
|
||||
+ alignment + "): alignment offset = " + alignmentOffset);
|
||||
}
|
||||
}
|
||||
|
||||
static void checkRemainingBufferSizeAligned(int rem,
|
||||
int alignment)
|
||||
static void checkRemainingBufferSizeAligned(int rem, int alignment)
|
||||
throws IOException
|
||||
{
|
||||
if (rem % alignment != 0) {
|
||||
|
@ -524,8 +523,7 @@ public class Util {
|
|||
}
|
||||
}
|
||||
|
||||
static void checkChannelPositionAligned(long position,
|
||||
int alignment)
|
||||
static void checkChannelPositionAligned(long position, int alignment)
|
||||
throws IOException
|
||||
{
|
||||
if (position % alignment != 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue