Commit 2db003f
fix(image): gracefully handle missing Docker/Podman engine (#539)
## Summary
- `ImageUtils.hostInfo()` now returns an empty string instead of
throwing `RuntimeException` when the container engine binary is missing
(`IOException`) or returns error output
- This allows callers to fall back gracefully rather than crashing when
neither Docker nor Podman is installed
- Updated test to assert empty string return instead of exception
## Test plan
- [ ] Verify image analysis works normally when Docker is available
- [ ] Verify image analysis degrades gracefully when neither Docker nor
Podman is installed
- [ ] Run existing `ImageUtilsTest` suite
🤖 Generated with [Claude Code](https://claude.com/claude-code)
## Summary by Sourcery
Handle missing container engine binaries gracefully when retrieving
image host info.
Bug Fixes:
- Return an empty string from ImageUtils.hostInfo when the Docker/Podman
binary is missing or returns only error output instead of throwing a
RuntimeException.
Tests:
- Update ImageUtilsTest to assert an empty string result when no Docker
path is available instead of expecting an exception.
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 7d20efe commit 2db003f
2 files changed
Lines changed: 40 additions & 4 deletions
File tree
- src
- main/java/io/github/guacsec/trustifyda/image
- test/java/io/github/guacsec/trustifyda/image
Lines changed: 17 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| 45 | + | |
| 46 | + | |
43 | 47 | | |
44 | 48 | | |
45 | 49 | | |
| |||
281 | 285 | | |
282 | 286 | | |
283 | 287 | | |
284 | | - | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
285 | 300 | | |
286 | 301 | | |
287 | | - | |
| 302 | + | |
288 | 303 | | |
289 | 304 | | |
290 | 305 | | |
| |||
Lines changed: 23 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
549 | 550 | | |
550 | 551 | | |
551 | 552 | | |
552 | | - | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
553 | 574 | | |
554 | | - | |
| 575 | + | |
555 | 576 | | |
556 | 577 | | |
557 | 578 | | |
| |||
0 commit comments