You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2025/05/28 12:39:59 UTC

(maven-clean-plugin) 01/01: close channel

This is an automated email from the ASF dual-hosted git repository.

elharo pushed a commit to branch resources
in repository https://gitbox.apache.org/repos/asf/maven-clean-plugin.git

commit 382ee4f75acaccf59263c7a447c0dc6642d07cee
Author: Elliotte Rusty Harold <el...@ibiblio.org>
AuthorDate: Wed May 28 08:39:51 2025 -0400

    close channel
---
 src/test/java/org/apache/maven/plugins/clean/CleanMojoTest.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/test/java/org/apache/maven/plugins/clean/CleanMojoTest.java b/src/test/java/org/apache/maven/plugins/clean/CleanMojoTest.java
index 02e8bf6..48b783f 100644
--- a/src/test/java/org/apache/maven/plugins/clean/CleanMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/clean/CleanMojoTest.java
@@ -168,7 +168,8 @@ public class CleanMojoTest {
     @InjectMojo(goal = "clean")
     public void testCleanLockedFile(CleanMojo mojo) throws Exception {
         File f = new File(getBasedir(), "buildDirectory/file.txt");
-        try (FileChannel channel = new RandomAccessFile(f, "rw").getChannel();
+        try (RandomAccessFile raf = new RandomAccessFile(f, "rw");
+                FileChannel channel = raf.getChannel();
                 FileLock ignored = channel.lock()) {
             assertThrows(MojoException.class, () -> mojo.execute());
         }
@@ -191,7 +192,8 @@ public class CleanMojoTest {
         assertNotNull(mojo);
 
         File f = new File(getBasedir(), "buildDirectory/file.txt");
-        try (FileChannel channel = new RandomAccessFile(f, "rw").getChannel();
+        try (RandomAccessFile raf = new RandomAccessFile(f, "rw");
+             FileChannel channel = raf.getChannel();
                 FileLock ignored = channel.lock()) {
             mojo.execute();
         }