-
Bug
-
Resolution: Fixed
-
P4
-
9
-
b161
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8176976 | 10 | Brian Burkhalter | P4 | Resolved | Fixed | b03 |
JDK-8306906 | 8u391 | kiran kumar J | P4 | Resolved | Fixed | b01 |
In this test there is a loop
long pos = 0L;
for (;;) {
bb.clear();
int n = fc.read(bb, pos);
if (n > 0)
pos += n;
// fc.size is important here as it is position sensitive
if (pos > fc.size()) // incorrect relational operator: should be >=
pos = 0L;
}
which is supposed to read continuously from a FileChannel. This will not happen however because the value of pos will reach fc.size() which is 1024*1024 + 1 and remain there for all subsequent iterations of the loop in which case fc.read() would no longer read any bytes. The relational operator ">" should be changed to ">=".
long pos = 0L;
for (;;) {
bb.clear();
int n = fc.read(bb, pos);
if (n > 0)
pos += n;
// fc.size is important here as it is position sensitive
if (pos > fc.size()) // incorrect relational operator: should be >=
pos = 0L;
}
which is supposed to read continuously from a FileChannel. This will not happen however because the value of pos will reach fc.size() which is 1024*1024 + 1 and remain there for all subsequent iterations of the loop in which case fc.read() would no longer read any bytes. The relational operator ">" should be changed to ">=".
- backported by
-
JDK-8176976 Incorrect relational operator in java/nio/channels/FileChannel/InterruptDeadlock.java
-
- Resolved
-
-
JDK-8306906 Incorrect relational operator in java/nio/channels/FileChannel/InterruptDeadlock.java
-
- Resolved
-
- relates to
-
JDK-8151862 java/nio/channels/FileChannel/InterruptDeadlock.java timed out intermittently
-
- Closed
-
- links to
(1 links to)