Just use virGetLastError instead of virCopyLastError. Calling virResetLastError is unnecessary because every public libvirt function will first reset the error when being called. --- src/main/java/org/libvirt/ErrorHandler.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/libvirt/ErrorHandler.java b/src/main/java/org/libvirt/ErrorHandler.java index 543829e..4dd7c90 100644 --- a/src/main/java/org/libvirt/ErrorHandler.java +++ b/src/main/java/org/libvirt/ErrorHandler.java @@ -20,14 +20,11 @@ public class ErrorHandler { * @throws LibvirtException */ public static void processError(Libvirt libvirt) throws LibvirtException { - virError vError = new virError(); - int errorCode = libvirt.virCopyLastError(vError); - if (errorCode > 0) { + virError vError = libvirt.virGetLastError(); + if (vError != null) { Error error = new Error(vError); - libvirt.virResetLastError(); /* - * FIXME: Don't throw exceptions for VIR_ERR_WARNING - * level errors + * Don't throw exceptions for VIR_ERR_WARNING level errors */ if (error.getLevel() == Error.ErrorLevel.VIR_ERR_ERROR) { throw new LibvirtException(error); -- 1.7.9.5 -- AV-Test GmbH, Henricistraße 20, 04155 Leipzig, Germany Phone: +49 341 265 310 19 Web:<http://www.av-test.org> Eingetragen am / Registered at: Amtsgericht Stendal (HRB 114076) Geschaeftsfuehrer (CEO): Andreas Marx, Guido Habicht, Maik Morgenstern -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list