6830721: (fc) test/java/nio/channels/AsynchronousFileChannel/Basic.java intermittent failure
Reviewed-by: sherman
--- a/jdk/test/java/nio/channels/AsynchronousFileChannel/Basic.java Sat Apr 18 14:10:27 2009 -0700
+++ b/jdk/test/java/nio/channels/AsynchronousFileChannel/Basic.java Mon Apr 20 09:30:50 2009 +0100
@@ -22,7 +22,7 @@
*/
/* @test
- * @bug 4607272 6822643
+ * @bug 4607272 6822643 6830721
* @summary Unit test for AsynchronousFileChannel
*/
@@ -431,10 +431,11 @@
throw new RuntimeException("isCancelled not consistent");
try {
res.get();
- if (!cancelled)
+ if (cancelled)
throw new RuntimeException("CancellationException expected");
} catch (CancellationException x) {
- // expected
+ if (!cancelled)
+ throw new RuntimeException("CancellationException not expected");
} catch (ExecutionException x) {
throw new RuntimeException(x);
} catch (InterruptedException x) {
@@ -442,9 +443,11 @@
}
try {
res.get(1, TimeUnit.SECONDS);
- throw new RuntimeException("CancellationException expected");
+ if (cancelled)
+ throw new RuntimeException("CancellationException expected");
} catch (CancellationException x) {
- // expected
+ if (!cancelled)
+ throw new RuntimeException("CancellationException not expected");
} catch (ExecutionException x) {
throw new RuntimeException(x);
} catch (TimeoutException x) {