Copilot commented on code in PR #13086:
URL: https://github.com/apache/cloudstack/pull/13086#discussion_r3161327095
##########
plugins/hypervisors/kvm/src/test/java/org/apache/cloudstack/utils/qemu/QemuImgTest.java:
##########
@@ -57,7 +57,7 @@ public static void setUp() {
Connect conn = new Connect("qemu:///system", false);
conn.getVersion();
libVirtAvailable = true;
- } catch (LibvirtException ignored) {}
+ } catch (LibvirtException | LinkageError ignored) {}
Review Comment:
Catching `LinkageError` is very broad and will also swallow issues like
`NoSuchMethodError`, `IncompatibleClassChangeError`, etc., which typically
indicate a broken/incompatible libvirt Java binding rather than “libvirt not
available”. Consider narrowing this to the specific linkage failures you want
to treat as “not available” (e.g., `UnsatisfiedLinkError` /
`ExceptionInInitializerError`) so genuine dependency regressions still fail the
test run.
```suggestion
} catch (LibvirtException | UnsatisfiedLinkError |
ExceptionInInitializerError ignored) {}
```
##########
plugins/hypervisors/kvm/src/test/java/org/apache/cloudstack/utils/qemu/QemuImgTest.java:
##########
@@ -57,7 +57,7 @@ public static void setUp() {
Connect conn = new Connect("qemu:///system", false);
conn.getVersion();
libVirtAvailable = true;
- } catch (LibvirtException ignored) {}
+ } catch (LibvirtException | LinkageError ignored) {}
Review Comment:
`Connect conn = new Connect(...)` opens a libvirt connection but it’s never
closed. Even though this is only a setup probe, leaving the connection open can
leak resources and interfere with subsequent tests/runs. Please ensure the
connection is closed (e.g., via try-with-resources if supported, or a finally
block calling `conn.close()`).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]