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

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-logging.git


The following commit(s) were added to refs/heads/master by this push:
     new 90d22ce  Test utility now restores the current thread's interrupt flag 
after catching InterruptedException
90d22ce is described below

commit 90d22ce4905c1c131d479ea277f35caf1313d2c0
Author: Gary Gregory <[email protected]>
AuthorDate: Wed Jan 28 16:08:13 2026 -0500

    Test utility now restores the current thread's interrupt flag after
    catching InterruptedException
    
    Clean up JUnit API uage
---
 .../java/org/apache/commons/logging/GarbageCollectionHelper.java | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git 
a/src/test/java/org/apache/commons/logging/GarbageCollectionHelper.java 
b/src/test/java/org/apache/commons/logging/GarbageCollectionHelper.java
index 8312776..6e903b3 100644
--- a/src/test/java/org/apache/commons/logging/GarbageCollectionHelper.java
+++ b/src/test/java/org/apache/commons/logging/GarbageCollectionHelper.java
@@ -17,6 +17,8 @@
 
 package org.apache.commons.logging;
 
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
 import java.io.Closeable;
 import java.io.IOException;
 import java.io.OutputStream;
@@ -26,6 +28,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
 
 // after: 
https://github.com/apache/logging-log4j2/blob/c47e98423b461731f7791fcb9ea1079cd451f365/log4j-core/src/test/java/org/apache/logging/log4j/core/GarbageCollectionHelper.java
 public final class GarbageCollectionHelper implements Closeable, Runnable {
+
     final class GcTask implements Runnable {
         @Override
         public void run() {
@@ -59,18 +62,18 @@ public final class GarbageCollectionHelper implements 
Closeable, Runnable {
         public void write(final int b) {
         }
     };
+
     private final AtomicBoolean running = new AtomicBoolean();
     private final CountDownLatch latch = new CountDownLatch(1);
-
     private final Thread gcThread = new Thread(new GcTask());
 
     @Override
     public void close() {
         running.set(false);
         try {
-            junit.framework.TestCase.assertTrue("GarbageCollectionHelper did 
not shut down cleanly",
-                    latch.await(10, TimeUnit.SECONDS));
+            assertTrue(latch.await(10, TimeUnit.SECONDS), 
"GarbageCollectionHelper did not shut down cleanly");
         } catch (final InterruptedException e) {
+            Thread.currentThread().interrupt();
             throw new RuntimeException(e);
         }
     }

Reply via email to