[libvirt] [PATCH v3] [libvirt-java] Fix Array IndexOutOfBoundsException for unknown error codes

Claudio Bley cbley at av-test.de
Thu Aug 9 15:04:24 UTC 2012


At Thu, 09 Aug 2012 08:39:39 -0600,
Eric Blake wrote:
> 
> > Rather, I would /very/ much like these superfluous prefixes of all enum
> > constants to be removed from the libvirt-java interface. They're of no
> > use really, despite adding to the code bloat.
> 
> Indeed - the whole point of bindings in OO languages is to remove the
> superfluous prefixes used for namespacing in C when we can instead use
> the object oriented namespacing; ErrorDomain.FROM_QEMU reads much better
> than ErrorDomain.VIR_FROM_QEMU.  A followup patch to alter the
> namespacing might be nice (but _then_ you have to worry about
> back-compat to existing clients; can you have two enum names, FROM_QEMU
> and VIR_FROM_QEMU, that both share the same numeric value?)

Well, no -- and yes. Enums in Java have an ordinal value automatically
attached to them, but they can have arbitrary other attributes also.

But, another thing I noticed is that quite a few Java methods return
an int when they really should return a boolean (throwing an exception
if the libvirt function failed).

Fixing this would also change the API. So, it's probably a good idea
bumping the minor version number of libvirt-java and just fix it once
and for all times instead of inventing some workaround now?

> > -- >8 --
> > Subject: [libvirt-java PATCHv3] Fix IndexOutOfBoundsException for
> >  unknown error number/domain/level
> >  codes.
> 
> 'git am' couldn't parse this properly, and I had to amend the commit to
> trim out the rest of your message (not a severe issue, but I'm not sure
> why things didn't quite go like normal).

Sorry for the inconvenience, maybe it's because I'm on Windows... I'll
try to test it before sending it off next time.

> ACK and pushed.

Thanks!
-- 
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




More information about the libvir-list mailing list