Skip to content

Commit bce54fa

Browse files
Kabirclaude
andcommitted
fix: properly handle InterruptedException in Docker detection
Replace broad Exception catch with specific exception types: - IOException for process execution failures - InterruptedException with proper thread interrupt status restoration This ensures proper concurrent behavior and prevents masking critical issues. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 5e67bed commit bce54fa

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎test-utils-docker/src/main/java/io/a2a/testutils/docker/DockerAvailability.java‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import org.slf4j.Logger;
44
import org.slf4j.LoggerFactory;
55

6+
import java.io.IOException;
67
import java.util.concurrent.TimeUnit;
78

89
/**
@@ -77,10 +78,13 @@ private static boolean tryContainerCommand(String command) {
7778

7879
int exitCode = process.exitValue();
7980
return exitCode == 0;
80-
} catch (Exception e) {
81-
// Command not found or failed to execute
81+
} catch (IOException e) {
8282
LOG.debug("Failed to execute '{} info' command", command, e);
8383
return false;
84+
} catch (InterruptedException e) {
85+
Thread.currentThread().interrupt();
86+
LOG.debug("Interrupted while waiting for '{} info' command", command, e);
87+
return false;
8488
}
8589
}
8690
}

0 commit comments

Comments
 (0)