On Thu, Feb 13, 2014 at 04:22:23PM +0100, Claudio Bley wrote:
Almost every class contains a processError() method with an
identical
definition, just forwarding the call to ErrorHandler.processError(Libvirt).
This function is always called after a libvirt function call (as per its
javadoc comment).
But, actually, there's no use in always calling processError when there was
no error signalled by the libvirt function having been called. This is just
a waste of CPU cycles.
Furthermore, it's more than ugly that the error handling is littered all
over the place in every class.
This patch lays ground for generalizing the error handling in a common
place and removing those functions from the individual classes.
Basically, this copies the processError(int) and processError<T>(T)
methods from the Connect class to the ErrorHandler class as static
methods.
It deprecates the processError(Libvirt) method, which will be removed
eventually in a later patch.
Signed-off-by: Claudio Bley <cbley(a)av-test.de>
---
src/main/java/org/libvirt/ErrorHandler.java | 47 ++++++++++++++++++++++++++-
1 file changed, 46 insertions(+), 1 deletion(-)
ACK
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|