6830721: (fc) test/java/nio/channels/AsynchronousFileChannel/Basic.java intermittent failure
authoralanb
Mon, 20 Apr 2009 09:30:50 +0100
changeset 2628 50912ad83111
parent 2627 c66fa5c0e626
child 2629 06517d95fadd
6830721: (fc) test/java/nio/channels/AsynchronousFileChannel/Basic.java intermittent failure Reviewed-by: sherman
jdk/test/java/nio/channels/AsynchronousFileChannel/Basic.java
--- 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) {