From 39f12a88e7b19eb2b60942c6a6d2038398ddcd3f Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Wed, 5 Apr 2023 20:16:13 +0000 Subject: [PATCH] 8305596: (fc) Two java/nio/channels tests fail after JDK-8303260 Reviewed-by: alanb --- test/jdk/ProblemList.txt | 4 ---- test/jdk/java/nio/channels/AsyncCloseAndInterrupt.java | 7 ++++--- test/jdk/java/nio/channels/FileChannel/Transfer.java | 9 ++++++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 3626be837f7..6ef9d973b5a 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -540,10 +540,6 @@ java/net/ServerSocket/AcceptInheritHandle.java 8211854 aix-ppc6 # jdk_nio -java/nio/channels/AsyncCloseAndInterrupt.java 8305596 generic-all - -java/nio/channels/FileChannel/Transfer.java 8305596 generic-all - java/nio/channels/AsynchronousSocketChannel/StressLoopback.java 8211851 aix-ppc64 java/nio/channels/DatagramChannel/ManySourcesAndTargets.java 8264385 macosx-aarch64 diff --git a/test/jdk/java/nio/channels/AsyncCloseAndInterrupt.java b/test/jdk/java/nio/channels/AsyncCloseAndInterrupt.java index 98408f34bf8..e88a874b82b 100644 --- a/test/jdk/java/nio/channels/AsyncCloseAndInterrupt.java +++ b/test/jdk/java/nio/channels/AsyncCloseAndInterrupt.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -469,8 +469,9 @@ public class AsyncCloseAndInterrupt { SocketChannel sc = (SocketChannel)ch; if (!sc.socket().isOutputShutdown()) throw new RuntimeException("Output not shutdown"); - } else if ((test == TEST_INTR) && (op == TRANSFER_FROM)) { - // Let this case pass -- CBIE applies to other channel + } else if ((test == TEST_INTR || test == TEST_PREINTR) + && (op == TRANSFER_FROM)) { + // Let these cases pass -- CBIE applies to other channel } else { throw new RuntimeException("Channel still open"); } diff --git a/test/jdk/java/nio/channels/FileChannel/Transfer.java b/test/jdk/java/nio/channels/FileChannel/Transfer.java index 9e2eeb49d72..453230fff95 100644 --- a/test/jdk/java/nio/channels/FileChannel/Transfer.java +++ b/test/jdk/java/nio/channels/FileChannel/Transfer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -95,8 +95,11 @@ public class Transfer { bytesWritten = sinkChannel.transferFrom(sourceChannel, 1000, 10); - if (bytesWritten > 0) - throw new RuntimeException("Wrote past file size"); + if (bytesWritten > 10) + throw new RuntimeException("Wrote too many bytes"); + + if (sinkChannel.size() != 1000 + bytesWritten) + throw new RuntimeException("Unexpected sink size"); sourceChannel.close(); sinkChannel.close();