changeset 1143:ccd08d4b19cf

6830721: (fc) test/java/nio/channels/AsynchronousFileChannel/Basic.java intermittent failure Reviewed-by: sherman
author alanb
date Mon, 20 Apr 2009 09:30:50 +0100
parents f1c76fb74e57
children e281812be4ce
files test/java/nio/channels/AsynchronousFileChannel/Basic.java
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/test/java/nio/channels/AsynchronousFileChannel/Basic.java	Sat Apr 18 14:10:27 2009 -0700
+++ b/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) {