virConnCopyLastError is not thread-safe, don't use it.
Reported by Ravi Pawar.
---
src/main/java/org/libvirt/Connect.java | 2 +-
src/main/java/org/libvirt/ErrorHandler.java | 17 -----------------
2 files changed, 1 insertions(+), 18 deletions(-)
diff --git a/src/main/java/org/libvirt/Connect.java
b/src/main/java/org/libvirt/Connect.java
index fb8ea89..7761c1f 100644
--- a/src/main/java/org/libvirt/Connect.java
+++ b/src/main/java/org/libvirt/Connect.java
@@ -1319,7 +1319,7 @@ public class Connect {
* @throws LibvirtException
*/
protected void processError() throws LibvirtException {
- ErrorHandler.processError(libvirt, VCP);
+ ErrorHandler.processError(libvirt);
}
/**
diff --git a/src/main/java/org/libvirt/ErrorHandler.java
b/src/main/java/org/libvirt/ErrorHandler.java
index 7b723bb..e30291b 100644
--- a/src/main/java/org/libvirt/ErrorHandler.java
+++ b/src/main/java/org/libvirt/ErrorHandler.java
@@ -28,21 +28,4 @@ public class ErrorHandler {
throw new LibvirtException(error);
}
}
-
- /**
- * Look for the latest error from libvirt tied to a connection
- *
- * @param libvirt
- * the active connection
- * @throws LibvirtException
- */
- public static void processError(Libvirt libvirt, ConnectionPointer conn) throws
LibvirtException {
- virError vError = new virError();
- int errorCode = libvirt.virConnCopyLastError(conn, vError);
- if (errorCode > 0) {
- Error error = new Error(vError);
- libvirt.virConnResetLastError(conn);
- throw new LibvirtException(error);
- }
- }
}
--
1.7.0.4