[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [libvirt-java] [PATCH] Avoid calling processError for functions that cannot fail



At Wed, 08 Jan 2014 16:31:38 +0100,
Claudio Bley wrote:
> 
> At Wed,  8 Jan 2014 16:25:30 +0100,
> Claudio Bley wrote:
> > 
> > The libvirt functions virNodeDeviceNumOfCaps, virNodeDeviceGetParent
> > and virNodeDeviceListCaps never indicate an error because they do not
> > fail.
> > ---
> >  src/main/java/org/libvirt/Device.java      | 19 ++++++-------------
> >  src/main/java/org/libvirt/jna/Libvirt.java |  2 +-
> >  2 files changed, 7 insertions(+), 14 deletions(-)
> > 
> > diff --git a/src/main/java/org/libvirt/jna/Libvirt.java b/src/main/java/org/libvirt/jna/Libvirt.java
> > index b026b04..a2bf42e 100644
> > --- a/src/main/java/org/libvirt/jna/Libvirt.java
> > +++ b/src/main/java/org/libvirt/jna/Libvirt.java
> > @@ -281,7 +281,7 @@ public interface Libvirt extends Library {
> >      String virNodeDeviceGetName(DevicePointer virDevicePointer);
> >      String virNodeDeviceGetParent(DevicePointer virDevicePointer);
> >      int virNodeDeviceNumOfCaps(DevicePointer virDevicePointer);
> > -    int virNodeDeviceListCaps(DevicePointer virDevicePointer, String[] names, int maxNames);
> > +    int virNodeDeviceListCaps(DevicePointer virDevicePointer, Pointer[] names, int maxNames);
> >      String virNodeDeviceGetXMLDesc(DevicePointer virDevicePointer);
> >      int virNodeDeviceFree(DevicePointer virDevicePointer);
> >      int virNodeDeviceDettach(DevicePointer virDevicePointer);
> 
> I just realized that this hunk does not belong to the patch. Please
> ignore it when reviewing.

Looking at this patch again made me think...

Libvirt is a connection based (ie. client / server) system. Which
means that basically *any* function could fail -- except those which
don't require a valid connection.

Self-NACK in this case.

This is a bit misleading in the documentation; I would have assumed
that a function documented as returning NULL representing "nothing
found" has no other meaning of indicating an error. But, rather, it
means either nothing found or an error occurred and I have to check
for an error, right?

Claudio
-- 
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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]